C++ Program to Print Gender
Write C++ Program to Print Gender
// CPP Program to print gender
#include <iostream>
using namespace std;
int main()
{
char c;
cout << "Enter F for female, M for male and O for others :--> ";
cin >> c;
if(c == 'F'|| c == 'f')
{
cout << "Your gender is Female";
}
else if (c == 'M'|| c == 'm')
{
cout << "Your gender is Male";
}
else if(c == 'O'|| c == 'o')
{
cout << "Your gender is Other";
}
else
{
cout << "Please give the right input..";
}
return 0;
}
Output:
Run 1:
Enter F for female, M for male and O for others :--> M
Your gender is Male
Run 2:
Enter F for female, M for male and O for others :--> f
Your gender is Female
Run 3:
Enter F for female, M for male and O for others :--> 0
Please give the right input..