in this little program i am trying to make, just to help me get used to programing in general. I can not get the second part to work correctly. I can't get the first response to happen on Y and the second to happen on N, just the second happens on either Y or N. i know there is no N in the code but when i add an N i just get the first response.
any help is appreciated. im teaching my self so when im stuck the way for me to learn is to see it and not to make the mistake again.
Code:#include <iostream> using namespace std; int main() { float number; cout<<"What is your favorite number? "; cin>>number; cin.ignore(); cout<<"Why is your favorite number " << number << "? Mentally tell me. HIT ENTER WHEN FINISHED\n" ; cin.ignore(); char Y = 0; cout<<"Are you sure your favorite number isn't 21? Y/N: "; cin>>Y; cin.ignore(); if ( Y == 0 ) { cout<<"I think we will get along well. \n"; } else if ( Y != 0 ) { cout<<"You should re-evaluate your decision. \n"; } cin.get(); }