Question: Select the C++ code segment which calculates and displays the max (maximum) value of a set of 10 numeric grades entered by the user. a)

Select the C++ code segment which calculates and displays the max (maximum) value of a set of 10 numeric grades entered by the user.

a)

double grade, max; for (int i=0; i<10; i++) { cout << "Enter grade"; cin >> grade; if (i==0) max = grade; if (grade > max) max = grade; } cout << max;

b)

double grade, max; for (int i=0; i<10; i++) { cout << "Enter grade"; cin >> grade; if (i==0) grade = max; if (grade > max) max = grade; } cout << max;

c)

double grade, max; for (int i=0; i<10; i++) { cout << "Enter grade"; cin >> grade; if (grade > max) max = grade; if (i==0) grade = max; } cout << max;

d)

double grade, max; for (int i=0; i<10; i++) { cout << "Enter grade"; cin >> grade; if (grade > max) max = grade; if (i > 0) max = grade; } cout << max;

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!