60 576
Assignments Done
97,9%
Successfully Done
In April 2018

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.
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions