Question: 2) C++ Programming: Conditional Statement. Please include detailed comments on your code so it is easy to understand what has been done. Thank you very

2) C++ Programming: Conditional Statement. Please include detailed comments on your code so it is easy to understand what has been done. Thank you very much.

Question 2:

Based on the below program (at the end of this question), which displays a number between 10 and 19 inclusive, modify the program so that it displays 3 numbers between 1 and 6 inclusively. The program then displays the product of the 3 numbers. One of the messages may be displayed in each of the following cases:

- Bravo, if the product of the three numbers is greater than 140.

- Very Good, if the product of the three numbers is strictly greater than 108, but less than or equal to 140.

- Good, if the product of the three number is strictly greater than 50, but less than or equal to 108.

- Failure in the other cases.

Example 1:

The first number is 5.

The second number is 6.

The third number is 4.

The product of the three of is 120. Very good.

Example 2:

The first number is 1.

The second number is 2.

The third number is 3.

The product of the three of is 6. Failure.

Below is the code for the program, that you will need to modify:

#include // For cin et cout

#include // Fonction srand and time

using namespace std;

void main(void) // main Programme

{

int aleatoire; //Dclaration of variables

cout << "The maximum random value of rand() is : " << RAND_MAX << endl; // Displaying the random maximum value of rand()

srand((unsigned)time(0)); // Using srand to guarantee a random variable with rand() aleatoire = rand(); // Generation of the random variable up to RAND_MAX

aleatoire = (aleatoire % 10) + 10; // returns the remainder from 0 to 9 and with +10 implies from 10 to 19 inclusive

cout << "The random value between 10 and 19 is : "<< aleatoire << " ! "; // Show result

}

Please include detailed comments on your code so it is easy to understand how it is done

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!