Statement not appearing at the right place

Hi I have an issue with my codes as according to what I created the fitness level have to appear right after I enter the time take to 3 miles. However it only appears once after repeating five times.
My codes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

struct fitnessProfile
{ 
	string name;
	int age;
	double time;
	 
};

void get_data(fitnessProfile & the_data);
//Postcondition: the_data.age and the_data.time have been given values that the user entered at the keyboard.

fitnessProfile myProfile;

int main()
{
	fitnessProfile myProfile;
	get_data(myProfile);
	

	double fitness;
	fitness = myProfile.time;
	if (fitness < 36)
	 {
	 cout <<"Your fitness is on Level 5!";

	 }
	else if (fitness <40)
	 { 
	 cout <<"Your fitness is on Level 4!";
	}
	else if (fitness <44)
	 {
	 cout <<"Your fitness is on Level 3!";
	 }
	else if (fitness <48)
	 {
	 cout <<"Your fitness is on Level 2!";
	 }
	else  
	 {
	 cout << "Your fitness is on Level 1!";
	}
	
}



	
	void get_data(fitnessProfile & the_data)
	{
		int x;
		x =0 ;
		while(x <5)
	
	{ 
		cout<<"Profile number: "<<x+1<<endl;
		cout << "Enter your name: ";
		cin >> the_data.name;
		cout << "Enter your age: ";
		cin >> the_data.age;
		cout << "Please enter time taken to walk 3 miles (mins): ";
		cin >> myProfile.time;
		x=x+1;
	}
		cin.ignore();
		cin.ignore();
	}



What's the point of line 59?
Line 59 is to create a loop to repeat the statements five times.
Why would you want to do that?
Based on the question it requires to have five people's profile there I needed to create the loop to hold five records
But you don't have any place to store 5 entries. You just have the one the_data.
What must I do in order to have place to store five entries
Topic archived. No new replies allowed.