Read an integer value into variable num1 and another integer value into variable num2 and to do the following: if the value in variable num1 is greater than the value in variable num2   add 1 to the value in num1  add 5 to the value in num2   then print the result of the product of the new value in num1 and the new value in num2;  otherwise,  subtract 1from the value in num1  substract 5 from the value in num2  and then print the result of the product of the new value in num1 and the new value in num2.  Is it one-way or two-way selection?Which structure to use: if or if/else?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 9SA
icon
Related questions
icon
Concept explainers
Question

Read an integer value into variable num1 and another integer value into variable num2 and to do the following: if the value in variable num1 is greater than the value in variable num2 

  •  add 1 to the value in num1
  •  add 5 to the value in num2 
  •  then print the result of the product of the new value in num1 and the new value in num2

otherwise, 

  • subtract 1from the value in num1 
  • substract 5 from the value in num2 
  • and then print the result of the product of the new value in num1 and the new value in num2
  • Is it one-way or two-way selection?Which structure to use: if
  • or if/else?
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT