Question #42465
Calculate the average of 10 different grades to be entered by a user.
1
Expert's answer
2014-05-14T09:11:40-0400
#include <iostream>int main() {    const int SIZE = 10;    int grade = 0;    double average = 0;    for ( int i = 1; i <= SIZE; i++  ) {        std::cout << "Please input grade number " << i << std::endl;        std::cin >> grade;        while ( grade > 100 || grade < 0 ) {            std::cout << "Grade can not have that value. It is grade, remeber? Values from 1 till 100 only" << std::endl;            std::cin >> grade;        }        average += grade;     }    std::cout << "Average " << (double)average / SIZE << std::endl;    return 0;}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS