Question: Write a C code that reads in a line of arithmetic expression from the console, checks its validity and outputs the result.The code should do
Write a C code that reads in a line of arithmetic expression from the console, checks its validity and outputs the result.The code should do the following:
Ask the user to enter a simple arithmetic expression, which should be in the formataopbwhere: ab: integer or floating point number op: operator : space: equal to
For each input, the program should validate that it is either an integer or a floating point number.
The program should validate for the correct valid operator
The program should validate that each input is separated by a space.
The program should display the result in the following line.The following error checking should be done:
If the input contains no errors: No Error"
If the number is not an integer or floating point number: "Parsing Error"
If the is no space separating the inputs: "Parsing Error"
If the operator is not valid: "Invalid Operator"
If the division is by zero: "Division by Zero"
If the modulo is by zero: "Modulo Error"
The program should terminate when the console input is "exit". The lab requires the use of loops, iterators and functions.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
