Using Floor and Ceil in a do while loop and for loop


I need help writing this program can any one help.
This what was given as an example. I got the for loop going but i'm not sure about the function floor and ceiling.

Write a program that uses a Do…While loop to ask the user to input 3 student first names. Use a For loop to input and average 5 scores for each student. Use a Function to find the ceiling and the floor of each average. The program should be in a format like this;

int main()
{
do
{
<code>
for loop
{
<code>
}
display
} while ()
}
double ceil()
{
<code>
}
double floor()
{
<code>
}

The screen output should look something like this;

Enter a student’s first name:
Mike
Enter 5 scores:
100
97
95
93
91
Total = 476
Average = 95.2
Ceiling = 100
Floor = 91

Enter a student’s first name:
Sam
Enter 5 scores:
90
97
95
93
91
Total = 466
Average = 93.2
Ceiling = 97
Floor = 90

Enter a student’s first name:
Frank
Enter 5 scores:
80
83
87
93
91
Total = 434
Average = 86.8
Ceiling = 93
Floor = 80

This is what I have so far.

# include <iostream>
# include <iomanip>
# include <string>
# include <cmath>
using namespace std;

int main()
{
string name;
int count = 1;
int Average = 0;
int score = 0;


do
{
cout << "Please enter student name:\n";
cin >> name;
cout << "Please enter 5 scores:\n";
int Total = 0;
int subtotal = 0;

for (int i = 1; i <= 5; i++)
{
cin >> score;
subtotal = subtotal + score;
Total = subtotal;
}



Average = Total / 5;
double ceil(Average);
double floor(Average);
cout << "TOTAL: " << Total << endl;
cout << "AVERAGE: " << Average << endl;
cout << "Celing: " << ceil << endl;
cout << "Floor: " << floor << endl;

count++;


} while (count <= 3);

system("PAUSE");
return 0;
}
Welcome to the forum.

Please edit your post and use the code format tags to format your source code.
Topic archived. No new replies allowed.