Question: Develop a flowchart and then write a C++ program using the operators shown and the if statements to solve the following program. a. Upon execution
Develop a flowchart and then write a C++ program using the operators shown and the if statements to solve the following program.
a. Upon execution of the program, your first name and the last name will be displayed at the top of the screen, properly centered. Your name will appear as in John Doe and not J. D. and it is not in block letters.
b. The program will then prompt the user for two integer inputs and the program will then compute the difference and the product of the two numbers and produce the results of both operations with appropriate labels. See sample output for the subtraction operation below. The output assumes a = 4, and b = 8. Part b requires no if statements.
Difference of a and b is equal to a - b or 4 - 8 and the result is -4
Product of a and b is equal to a * b or 4 * 8 and the result is 32
c. The program will then use the same two integer numbers and perform the following operations. The program uses if statements and displays the relations between the two numbers for the following relational operators:
<, ==, >=
Each of these operators requires two operands: use the first integer number as the first operand and the second integer number as the second operand. See sample of output desired below.
a < b is 4 < 8 and the result is true
where a is the first number and b is the second number. Your solution will work for any two integer numbers. The same format is used for the other two relational operators. The state of the result is reported via strings true or false.
(d) The program will then use the same two integer numbers and computes different operations using the following arithmetic and logical operators:
-=, /=, &&
The result of these operations is stored in the first operand. See example below.
a -= b is 4 -= 8 and the result is a = -4
Note that a = -4 is used in the next operation.
or
a /= b is -4 /= 8 and the result is a = 0
Note that a new value of a is used after each operation (i.e. a is rippled to other operations).
Hints:
Your program will only have one main() function, one return statement, and anything declared globally, like #include
Make sure your program executes correctly.
Make sure the variables are correctly declared without any conflicts with other variables. You may have to change some of the variables to make each variable unique.
You need to run the program four times for the set of numbers shown below.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
