65 863
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #42465 in C++ for Adeniji Oyewale

Question #42465
Calculate the average of 10 different grades to be entered by a user.
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions