Clearing memory for variables

Hi everyone. I was running through one of my chapter exercises and used this program as an exercise. It compiles and runs yet when I enter the three test scores it always come out the same answer which is... 2296024.7

Here's the program

// This program averages three test scores
# include <iostream>
# include <iomanip>
using namespace std;

int main(void)

{
const int HIGH_SCORE = 95; // A high score is 95 or greater
int score1, score2, score3; // To hold three test scores
double average; // To hold the average score

// Get the three test scores.
cout << "Enter 3 test scores and I will average them; ";
cin >> score1, score2, score3;

// Calculate and display the average score.
average = (score1 + score2 + score3) / 3.0;
cout << fixed << showpoint << setprecision(1);
cout << "Your average is " << average << endl;

// If the average is a high score, congratulate the user.
if (average > HIGH_SCORE)
cout << "Congratulations! That's a high score!\n";
return 0;

}

Any help would be greatly appreciated.
I changed line 15 to:
cin >> score1 >> score2 >> score3;
Edit: Please use code tags in the future to surround your code. :)
Last edited on
I can't believed I missed it. Thanks.
Sorry about not putting code tags in, how do I do that again?

Thanks again.
Code tags:
[code]code goes here[/code]

Just helps the helpers read the code. Whenever I see code not in these tags I usually copy paste them into an editor to read it.

I am glad I fixed your error, and welcome to the forums :)
Topic archived. No new replies allowed.