I have been given an assignment to write a C++ program that inputs integer numbers bewtween 0 and 100 until -1 is entered and then outputs the average of those numbers. The average must be shown with two decimal places, even if they are both 0. Your program must use at least one function. Please remember our class is still in the basic functions of programming. I also had to input those two lines with cout.setf, this was require by the teacher. Thanks for any help, our teacher is one of the worst ones I have had in my entire time at college.



[CODE]

#include<iostream.h>
using namespace std;

void prompt();

main()
{
cout.setf(ios::fixed, ios::floatfield);
cout.setf(ios::showpoint);

int score=0;
int total=0;
int count=0;
int sentinel=-1;
while (score!=sentinel)
{
prompt();
cin >> score;
if (score!=sentinel)
{
total=total+score;
count=count+1;
}
if (count > 0)
cout << "The average is: "
<< total/count << endl;
else
cout << "No genuine scores were entered"<< endl;
return 0;
}
void prompt ()
{
cout << "Enter a number: ";
}