Need help with code/cin please

I'm working on a project for school. It's supposed to work for male and female, but I am running into a problem where entering "F" at the first cin shows both the following cout's but then ends the program without pause.

Example:
Hello, let's find the height of your child!
What is the gender of your child?
Press M for male, F for female, or Q to quit.
F
Please enter the height of the mother in feet, then inches.
Feet:
Inches:
----jGRASP: operation complete.


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
  #include <iostream>
#include <string>
#include <cmath>

using namespace std;
int main ()
{
   int motherHeight;
   int feetMother;
   int inchesMother;
   int fatherHeight;
   int femaleChild = 'F';
   int maleChild = 'M';
   int genderOfChild;
   int femaleChildHeight;
   int maleChildHeight;
   
   cout << "Hello, let's find the height of your child!" ;
   cout << endl;
   cout << "What is the gender of your child?" ;
   cout << endl;
   cout << "Press M for male, F for female, or Q to quit." ;
   cout << endl;
   cin >> genderOfChild ;
   
if (genderOfChild == 'F');
{
   cout << "Please enter the height of the mother in feet, then inches.";
   cout << endl;
   cout << "Feet:";
   cout << endl;
   cin>> feetMother ;
   cout << endl;
   cout << "Inches:";
   cin >> inchesMother ;  
}
return 0;
}
 
the easiest fix is to change 14 to type char.
You also have a semicolon at the end of line 26 that shouldn't be there!
Topic archived. No new replies allowed.