Assume that the variables gpa, deansList and studentName, have been declared and initialized . Write a statement that both adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5.

Respuesta :

Answer:

Following are the statement which is given below:

if (gpa > 3.5)  // check the condition if gpa exceeds 3.5.

{

deansList++;  // increment of 1 in the deansList variable

cout << studentName;  // display the studentName,  

}

Explanation:

The description of the statement

  • In the if statement we check the condition of "gpa" .if  "gpa"  is greater then 3.5 then it executed the statement inside the if block otherwise nothing will be executed.
  • if control moves to the if part it adds to 1 to the deansList.
  • Finally, display the value of studentName.
ACCESS MORE
EDU ACCESS