Question
C ++ Only - The program must ask for the following four pieces of information. These must be asked for individually: a. The course department
C ++ Only
- The program must ask for the following four pieces of information. These must be asked for individually: a. The course department (for example CMSY) b. The course number (for example 141) c. The course section (for example N002) d. The course title (for example Intro to Comp. Sci.) - Once all four elements are entered, the code must put them together into a single string using the c-string strcpy_s and strcat_s functions. The string must be in the form: a. DEPT-num (section) Title b. For example: "CMSY-141 (N002) Intro to Comp.Sci." c. The code must include the appropriate punctuation and spaces when creating the string. The code must not require the user to enter in the "- "or the "()".
- Once the full string is created, the code must display the full string. - The code must display the length of the string using the c-string strlen function. - The code must use the c-string strcmp function to test the department to determine if the class is a CMSY class. a. If it is a CMSY class, the code must display a message stating that this is a computer science class. b. If it is not a CMSY class, the code must display a message stating that this is not a computer science class. - The code must call a void function that takes the c-string as a parameter. In this function the code must use the cctype "is" functions to count the number of alpha characters, the number of numeric characters, the number of punctuation characters and the number of spaces in the full string. Once counted, the code must display the counts to the screen.
Please enter in the department name: CMSY Please enter in the class number: 141 Please enter in the section number: NO02 Please enter in the class title: Intro to Comp. Sci. The course entered is: CMSY-141 (NO02) Intro to Comp. Sci. The size of the string is: 35 This is a Computer Science Class The number of alphas = 19 The number of digits = 6 The number of spaces = 5 The number of puncts - 5 Do you wish to exit the program (Y or N) d Please enter Y or N: n Please enter in the department name: ARTS Please enter in the class number: 175 Please enter in the section number: NO05 Please enter in the class title: Photography I The course entered is: ARTS-175 (NO05) Photography I The size of the string is: 29 This is not a Computer Science Class The number of alphas = 17 The number of digits = 6 The number of spaces = 3 The number of puncts = 3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started