For loop going crazy

I tried using cin to input name1 and name2 before but it still has the same results, but it's because I'm putting a space in between that the for loop whacks out

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
  
// This program will use for loops and 
// switch staements to determine measure
// the body fat of either a male or female

//To Do:
// 1: Ask Name
// 2: Determine Gender
// 3: Input Weight & Measurements
// 4: Calculate Fat Percentages
// 5: Repeat Loop ( Well actuallty first thing to do)


// Step 0: Housekeeping
#include <iostream>
using namespace std;
#include <string>
int main()

{
	// Step 1: Declarations 
	string name1, name2;
	float A1; // [BOTH][Women] (body weight x 0.732) + 8.987 -- [Men] (body weight x 1.082) + 94.42
	float A2; // [BOTH][Women] wrist measurement 9 at (fullest point) -- [Men] wrist measurement x 4.15
	float A3; // [Women ONLY] waist measurment (at navel) x 0.157
	float A4; // [Women ONLY] hip measuremnt  (at fullest point) x 0.434
	float A5; // [Women ONLY] forearm measurement (at fullest point) x 0.434

	float B;  // "B" (stands for body perhaps?) -- [Women] B = A1 + A2 - A3 - A4 + A5 -- [Men] B = A1 - A2

	float BodyFat;            // [BOTH] Body fat = body weight - B 
	float BodyFatPercentage;  // [BOTH] Body fat percentage = body fat x 100 / body weight 
	int gender;
	// Step 2: For Loop
	int i;					// Declared to be used with for loop
	for (i = 1; i < 6; i++) // for loop
	{

		
		{
			// step 3: start of loop statements & user input
			cout << "Enter the first and last name of the person to measure body fat of." << endl;
			cin.getline >> (name1, name2);
			cout << "Enter 1 if gender is male, or 2 if gender is female" << endl;
			cin.getline >> (gender);


		}
		
		switch (gender)
		{
		case (1): cout << "Male\n";
			break;
		case (2): cout << "Female\n";
			break;
		default: cout << "Enter Gender";

		
		}
	}
	






	// Step 4: End of For loop & Final Step - Ending Program

	return 0;


}
getline(cin,name1);
getline(cin,name2);
getline(cin,gender);
Topic archived. No new replies allowed.