Question: C programming class: C/C+ Your program should present a menu with 4 options, 1) Print author info 2) perform integer operation 3) perform floating point
C programming class: C/C+
Your program should present a menu with 4 options, 1) Print author info 2) perform integer operation 3) perform floating point operation 0) Exit
Where selection 1 prints your information (name and student id) selection two performs an integer math operation selection 3 performs a floating point (non whole number) math operation. Selection 0 will exit the program immediately. Any other selection will print an error message stating that an invalid selection was made.
When one of the math operation selections are chosen, the user will enter a simple math formula (such as "1+1") you should then calculate the result of their entered formula and print both the operation and the result to the screen. The result should be preceeded by the text "OUTPUT: " The result should include two values to the right of the decimal. for example if the user entered: "4*6"
You would print: OUTPUT: 4 * 6 = 24.00
You can expect the user to enter the formula in the format of: op1
The operations you must support are: + addition - subtraction * multiplication / division % modulus
Make sure your results are mathematically correct (you will be graded on math as if this were a math class.
To get full credit you need to follow the output rules exactly. the file check.sh can be used to check some basic operations for your program. Run it from the command prompt using the following syntax ./check.sh _path_to_executable
A few programming notes: scanf is the intput counterpart to printf's output. To print and integer and a character you would use: printf("integer: %d char: %c ", iA,cA); to read in an integer and a character from the screen you would use: scanf("%d%c", &iA, &iC); remember: blindly accept that you need the '&' for scanf with chars doubles, and ints.
Also: when when working with data types (such as int and double) you can tell the program to treat something like a different type by "casting" it. For example to tell the program to treat the char variable cA as an integer, you use the following code: (int)cA the (int) tells the computer that the variable after it should be treated as an int (pretend that it is an int) This does not change the value of cA in anyway, it merely for this particular instance right now treats cA as an integer. Since I'm telling you this, it may be of some importance for this assignment.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
