The program says it's stopped working after I input the first number...
#include <iostream>
using namespace std;
int average();
int main(){
char answer;
cout << "Average calculator." << endl;
cout << endl;
cout << " Enter a stream of positive numers (0 or above)." << endl;
cout << "Enter a negative number to indicate you are finished." << endl;
average();
cout << "Do you want to compute another average (y or n)?" << endl;
cin >> answer;
while (answer == 'y')
{cout << "Average calculator." << endl;
cout << endl;
cout << " Enter a stream of positive numers (0 or above)." << endl;
cout << "Enter a negative number to indicate you are finished." << endl;
}
if (answer == 'n')
{return 0;}
return 0;
}
int average(){
int value = 0;
int count = 0;
int sum = 0;
int average;
while (value >= 0)
{cin >> value;
sum = sum + value;
count++;
count = count - 1;
average = sum / count;
if (value < 0)
{return average;}
}
}