problem answer please

Write a C++ program that finds the average hours spent programming by each student
in every day over total three days. Note that the program should take the number of the
students and the number of hours worked by students per each day; from the user as an input.
(Use Nested For loops).
Ok I give in, is the answer zero?
is this right ?


#include <iostream>
using namespace std;
void main()
{
double number_of_students, days = 3, average = 0 , hours=0;
int day_number=1;
cout << "enter number of students" << endl;
cin >> number_of_students;
while (day_number <= 3)
{
cout << "Enter Number of hours of each student per day" << endl;
cin >> hours;
day_number++;
}
average += hours;
average /= days;
cout << "average is :" << average << endl;
}
is this right ?

No. main returns type int and you need to re-read the question, particularly the part in parentheses.
Topic archived. No new replies allowed.