- 2

How to compute the average of 4 quizzes using while statement

While statement

17th Nov 2017, 3:34 AM
Richard Matthew Mamuyac
Richard Matthew Mamuyac - avatar
6 odpowiedzi
+ 3
Define *quizzes*
17th Nov 2017, 3:42 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
quizzes? what is quizzes?
17th Nov 2017, 5:16 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
What is the full task? Just tell me
17th Nov 2017, 3:50 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
the average
17th Nov 2017, 3:48 AM
Richard Matthew Mamuyac
Richard Matthew Mamuyac - avatar
+ 1
You mean 4 numbers?
17th Nov 2017, 3:49 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
Have you solved this? well, in case you haven't, here's an example, go through it, I put comments some places to explain. #include <iostream> using namespace std; int main() { // Sample quiz scores float quiz[] = {7.54, 8.35, 7.92, 6.98}; int index = 0; // For array iteration float sum = 0; // Score summary while(index < 4) { sum += quiz[index]; // Sum up scores index++; } // divide by number of quizzes float avg = sum / 4; cout << "Your quiz average " << avg; return 0; } Hth, cmiiw
17th Nov 2017, 7:41 AM
Ipang