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
Get step-by-step solutions from verified subject matter experts
