I am completely new to c++ and have no idea what am doing or should be doing but am ready to learn. My first problem is to write a code "to calculate average score of uncertain numbers of student and the output should be (number of students,total points and average)".
This is what i have so far, have been on this for over 12hrs and i just don't know what to do anymore - any help will be greatly appreciated.
Thank-you much.
Effizy.
#include <iostream>
using namespace std;
int count, score;
float average=0.0;
count=0
int numTimesNeeded = [];
int total=0;
while ( count < numTimesNeeded )
int main(int argc, char *argv[])
{
cout <<"***************** Score Calculator 1.0 *****************"<<endl;
cout <<"Welcome!"<< endl;
cout <<"This program computes the average score of students"<<endl;
cout <<"You supply the data on: the number of students and score for each student"<<endl;
cout <<"The program will compute the total and average score for you."<<endl;
cout <<"**********************************************************"<< endl;
cout <<"Let's get to work ..." << endl;
cout <<"Enter the score for test " << count + 1 << ": ";
cin >> score;
total += score;
count++;
{
average = float(total) / numTimesNeeded;
cout <<"The average of the " << numTimesNeeded << " test scores is:" << average << endl;
First of all you try to do something with numTimesNeeded.. i dont know what.. but its very wrong
change int numTimesNeeded = []; to int numTimesNeeded = 0;
Next up, your while loop is outside of a function! put it in main like this
(also this allows you to get numTimesNeeded before you start the loop)
1 2 3 4 5 6 7 8 9 10 11 12 13
int main()
{
cout << "please input numTimesNeeded";
cin >> numTimesNeeded;
while ( count < numTimesNeeded )
{
// rest of the code here, from **score calculator 1.0** to count++
}
average = float(total)/numTimesNeeded;
cout << "the average....
system("pause");
return 0;
}