Question: c++ with copyable code please!!!! . . . . . A. (27 Points) Write a complete, working C++ program called euidA.cpp (where euid is your

c++ with copyable code please!!!! . . . . . A. (27c++ with copyable code please!!!!

. . . . . A. (27 Points) Write a complete, working C++ program called euidA.cpp (where euid is your EUID) that does the following: You need to find sum of digits in a string. The sum is either numeric sum or ASCII sum (See Sample Output). Declare an enumeration constant that can take two types of digit values Numeric, and ASCII. Assign characters 'N', and 'A' respectively to the data items. Declare a string variable to read a string from the user. Using suitable prompt, read a string from the user. The string can have multiple words, each word separated by a single space. Declare an integer variable named sum to store the sum of the digits of the string. Declare a character variable. This character variable will represent one of the two digit value types of your enumeration data. Using cin and cout statements, prompt the user to enter an appropriate character to select the character type. The user may choose to enter the character in either uppercase or lowercase but your program must work for either case. Design a switch-case block with a default case using your character variable as the switching expression. Your statements must have the enumeration constants -- Numeric, and ASCII-- as the case constants. For Numeric case, in a loop of your choice: Parse the string one character at a time. Check if the character is a digit. If it is, find the numeric value of the digit. HINT: The ASCII value of character 'O' is 48, while the numeric value is 0. Accumulate the numeric value in the sum variable. o For ASCII case, in a loop of your choice: Parse the string one character at a time. Check if the character is a digit. If it is, accumulate the ASCII value of the digit in the sum variable. Use the default case to inform the user if the user makes the wrong selection of character type. Display the computed sum using with a suitable message. Due to time constraints, no comments are required in this code. o 1 o

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!