Can anyone tell me why this is not averaging correctly. New at this thanks in advance.
Can anyone tell me why this is not averaging correctly. New at this thanks in advance.
Forgot to attach program.
#include <iostream>
using namespace std;
void main()
{
float test,count,sum,avg,final;
sum=0;
count=0;
final=0;
while(count<=3)
{
sum+=test;
count++;
cout << "Input a test score: ";
cin >>test;
}
cout <<"Now enter the final grade: ";
cin >>final;
final=final * 2;
cout << "final grade weighted at: " << final << endl;
avg = (test + final * 2)/6;
cout << "The average is: "<< avg << endl;
}
Do this
sum+=test;
After this (not before)
cout << "Input a test score: ";
cin >>test;