Ask Question

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.

+4
Answers (1)
  1. 8 March, 03:58
    0
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Assume that the variables gpa, deansList and studentName, have been declared and initialized. Write a statement that both adds 1 to ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers