file input and output

hello i am working on demonstrating input and output of files. I am getting an error prompt when attempting to run the attached code, without it showing any errors:

int number;
int sum = 0;
double average = 0;
ifstream inputFile; //input numbers from data.txt
inputFile.open("data.txt");
if (inputFile) { //if the file opens
while (inputFile >> number) {
sum = sum + number;
}//end of while statement
average = sum / 20.0;
}//end of if statement

else { //filename wrong or nonexistent
cout << "File Does not Exist" << endl;
}//end of else statement
inputFile.close();
ofstream outputFile;
outputFile.open("results.txt");
outputFile << "The number of values is 20." << endl;
outputFile << "The sum of the numbers is: " << sum << endl;
outputFile << "The aveage of the numbers is: " << average << endl;
outputFile.close();
return 0;

any assistance would be greatly appreciated
I am getting an error prompt

And the error prompt is? We can't see the program output on your computer.

PLEASE learn to use code tags, they make reading and commenting on code MUCH easier.
http://www.cplusplus.com/articles/jEywvCM9/

HINT: you can edit your post and add code tags.
Topic archived. No new replies allowed.