Just trying out my code for fun but when asked about my age and I typed no then it skipped a line..how do I make it work?
#include<iostream> using namespace std; int main() { char name [6]; int num = 1; char no ; cout <<"Hi.My name is Anna "<< endl; cout <<"Whats yours \?"; cout << "\n"; cin >> name ; if (name) { cout << "Oh nice to meet you\n " << name << endl; } else if (no) { cout << "How rude...what an idiot"; } cout << "May i know your age \n" << endl; cin >> num ; cout << "\n"; if (no) { cout << "You cant talk to me like that" << endl; } cout << "\n"; if (num > 10) { cout << "You should focus on studies,since youre very young" << endl; } if (num > 20) { cout << "Wow you grew up so fast boy" << endl; } if (num > 30) { cout << "You were just a kid when i first saw you " << endl; } cout << "\n"; cout <<"Pardon me but i have to go somewhere but great seeing you again"; }