Problem with function

Hi guys! Im a noob when it comes to C++ and recently i have some assignments to do. this is one of them:

This question is based on contents covered in Chapter 10 of the textbook.
Examine the following requirement and answer the questions that follow:
The program determines the fitness level based on the information given in Table 3.1.
Fitness Level
Time it takes to walk 3 miles
1
More than 48 min
2
More than 44, but less than or equal to 48 min
3
More than 40, but less than or equal to 44 min
4
More than 36, but less than or equal to 40 min
5
Less than 36 min
Table 3.1
(a) Construct a C++ record type, fitnessProfile that captures the name, age, time and fitness. Write down the C++ declaration of a variable, myProfile to hold a table of 5 such records.
(3 marks)
(b) Write a main program that uses a loop to read in the name, age and time. The read in values are stored in the array of structure records, myProfile. It determines the fitness level according to the criteria stated in Table 3.1 and stored the value in the field element, fitness. After the completion of data entry and determination of fitness, it uses a loop to traverse and display the values of each field element. Comment your code to enhance readability.

and this is my source code:
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
struct Fitness
{
string name;
double age;
double timing;
double totalcost;
double getlevel(double timing);
};
int main()
{
Fitness myProfile[5]; // Name of record structure
for (int i = 0; i<5; i++)
{
cout << "Enter name: ";
cin >> myProfile[i].name;
cout << "Enter age: ";
cin >> myProfile[i].age;
cout << "Enter running time: ";
cin >> myProfile[i].timing;
cout << endl;
}
cout <<endl << "Name of the five peeps" <<endl;
// display total cost of each type of fruit purchased
for (int i = 0; i<5; i++)
{
cout << myProfile[i].name <<endl;
cout << "Fitness level:" << endl;
}
cout <<endl << "Age of the five peeps" <<endl;
// display total cost of each type of fruit purchased
for (int i = 0; i<5; i++)
{
cout << myProfile[i].age <<endl;
cout << "Fitness level:" << endl;
}
cout <<endl << "Timing of the five peeps" <<endl;
// display total cost of each type of fruit purchased
for (int i = 0; i<5; i++)
{
cout << myProfile[i].timing <<endl;
cout << "Fitness level:" << endl;
}
cin.ignore();
cin.ignore();
return 0;
}

double getlevel(double timing)
{
if (timing > 48)
{
cout << "Fitness level:" << myProfile.timing << '';
cout << endl;
return getlevel;
}
if (timing > 44) && (timing <= 48)
{
cout << "Fitness level:" << myProfile.timing << '';
cout << endl;
return getlevel;
}
if (timing > 40) && (timing <= 44)
{
cout << "Fitness level:" << myProfile.timing << '';
cout << endl;
return getlevel;
}
if (timing > 36) && (timing <= 40)
{
cout << "Fitness level:" << myProfile.timing << '';
cout << endl;
return getlevel;
}
if (timing < 36)
{
cout << "Fitness level:" << myProfile.timing << '';
cout << endl;
return getlevel;
}
}

I can get the first part going (Listing out the names, age and timing) but im not sure where i did wrong in the second part. I suck at function btw...
Please help me out. Thx a bunch!
Topic archived. No new replies allowed.