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.
#include <iostream>
#include <string>
#include <cmath>
usingnamespace 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;
}