Answer to Question #40866 in C++ for Syed Talha Shah

Question #40866
Write a Program in C++ to input a single letter in a char variable. If "m" is input print "You are male" otherwise print "You are female" by using conditional expression operator.
1
Expert's answer
2014-03-31T14:30:45-0400
#include <iostream>

using namespace std;

int main() {
char character;

cout<<"Please input the character"<<endl;
cin>> character;
if (character == 'm') {
cout<<"You are mail"<<endl;
} else {
cout<<"You are feemale"<<endl;
}

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS