Question: Rubrics 3 point(s): Correct implementation of main (scanf, function call, and printing.) 2 point(s): Correct declaration of global variables. 2 point(s): Correct implementation of function


Rubrics 3 point(s): Correct implementation of main (scanf, function call, and printing.) 2 point(s): Correct declaration of global variables. 2 point(s): Correct implementation of function calculator(). 1 point(s): Correct output. 2 point(s): No syntax errors. Create a basic calculator that performs the 4 basic operations (addition, subtraction, multiplication, and division). The operator and the two numbers have to be user input into global variables. You will also need an extra global variable called result (total 4 global variables). Use the following codes for each operator: Addition: + Subtraction:- Multiplication: * Division:/ Create a function called calculator() with return type void that does not take any parameters, but instead uses the global variables. The function carries out the operation depending on the operator that was input and stores the result in the variable result. Your main function should read in the input into the global variables and then call calculator to do the calculation. You must then print the output from main. Example Enter a: 5 Enter b: 6 Enter operator: + Result = 11
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
