Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write the code in c++. je: 11:59pm on Thursday, January 26 rogram Purpose - Check relational expressions for correctness. The program should accept relational
Please write the code in c++.
je: 11:59pm on Thursday, January 26 rogram Purpose - Check relational expressions for correctness. The program should accept relational expressions input from the standard input device (using cin) in the format integer arithmetic-operator integer less-than-or-greater-than-symbol integer Assume that the user will input expressions in this format, entering only integer values for the numbers, and single characters for the arithmetic and relational operators. If the arithmetic operator entered is not a valid C++ arithmetic operator (+,, *, /,% ) the program should output "Unrecognized arithmetic operator" followed by the character input where an arithmetic operator was expected (see examples below). If the relational operator entered is not , the program should output "Unrecognized relational operator" followed by the character input where a relational operator was expected (see examples below). The program should determine if the expression entered is a true statement. If the expression is a true statement, output the relational expression followed by " - Correct". If the expression is a false statement, output the relational expression followed by " - Incorrect". Example input/output pairs Input: 3+4>1 Output: 3+4>1 - Correct Input: 12%728 Output: Unrecognized arithmetic operator Input: 373 Output: Unrecognized relational operator * After each relational expression entered, the user will input 'c' to continue (to enter another relational expression) or ' q ' to quit. The program should read each input relational expression and produce the corresponding output as described above until the user enters q. After the user enters q, the program should output a summary of the results in the format: number-correct of total-number-of-expressions = percent-correct\% The percent correct should display with two places following the decimalStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started