This is my assignment and it is due tomorrow. I am only doing it now because my other classes have me swamped. This is supposed to be my fall break. Anyways, I really do not understand this assignment, but what code i do have so far is included at the bottom. As far as I can tell she wants 5 functions... can someone please explain this stuff to me, I do not want it written for me, but please explain this to me like I am a beginner because I am.
CSCI 1010 Programming Assignment 5
A. Purpose- Write a program that uses functions, switch statement, type char data and a for loop.
B. Due Date- Due by 8 p.m. on Wednesday 10/18/06
C. Program Description – Name the program a5yourlastname.cpp
Write a C++ Program that uses functions to solve simple mathematics problems. The main function should prompt for and input how many integer sets of data to process. The main function should use a loop that will prompt the user to input a single character (an uppercase A, S, M or D) followed by two real numbers. Use the switch statement (see pages 270- 274) to determine which character was entered and call one of the following 4 functions that the program must declare and define:
Add if A was entered to add the two type double numbers and return their sum
Subtract if S was entered to subtract the second number from the first and return the difference
Multiply if M was entered to multiply the two numbers and return their product
Divide if D was entered to divide the second number into the first and return the quotient. If the second number is 0 do not call the function but display a message that division by zero is not allowed.
After the appropriate function is called and the answer is returned to the main function call a void function that is passed the 2 numbers, the symbol for the math operator and the answer. The function will display the answer as an equation:
num1 symbol num2 = answer
where num1 and num2 are displayed with one decimal place and the symbol is +, -, * or /.
If the single character entered is not an A, S. M or D then do not prompt for the two numbers but display an appropriate error message.
The program must be written to declare, define and call the four functions described above. It must also use the switch statement and process integer sets of data. A sample run of the program is below where the bolded numbers are the inputs typed as the program is running.
How many problems to solve? 7
Enter an A, S, M, or D: M
Enter two real numbers to multiply: 2.2 3.1
2.2 * 3.1 = 6.8
Enter an A, S, M, or D: S
Enter two real numbers to subtract: 5.6 3.1
5.6 - 3.1 = 2.5
Enter an A, S, M, or D: D
Enter two real numbers to divide: 2.2 0
Division by zero is not allowed
Enter an A, S, M, or D: A
Enter two real numbers to add: 6.51 2.11
6.5 + 2.1 = 8.6
Enter an A, S, M, or D: D
Enter two real numbers to divide: 2.2 2.0
2.2 / 1.0 = 1.1
Enter an A, S, M, or D: P
Must enter an A, S, M or D
Enter an A, S, M, or D: A
Enter two real numbers to add: 1.2 1.1
1.2 + 1.1 = 2.3
Code:#include<iostram> #include<iomanip> double add (double num1, double num2); //add num1 to num2 int main() { double total; char letter; cout << "Enter a letter (A,S,M,D):" << endl; cin >> letter; cout << "Enter two numbers:" << endl;