For some reason, it is giving me an error like:
lvalue required as left operand of assignment |
on lines 11 and 15 when I use code like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
// istream ignore
#include <iostream>
using namespace std;
int main () {
char answer;
question: cout << "Has Thanksgiving already passed?";
answer = cin.get();
cin.ignore(1);
cout<<answer<<endl;
if(answer= 'Y'||answer = 'y')
{
cout<<"I missed out!";
} //end if
else if (answer = 'N'||answer = 'n')
{
cout<<"Still gives you time for Black Friday! Are you going to buy me some better RAM?";
} //end else if
else
{
cout<<"I didn't understand you. Please speak up.";
goto question;
} //end else
return 0;
} //end main
|
I was wondering if I used the if statements correctly...
Last edited on
Try and keep obscenities off the site. Also, Justin Bieber jokes are getting old, they're not funny, and annoying.
Your issue is that the comparison operator is ==
Change the single equals signs (assignment = ) to double equals signs (equality test == )
EDIT: Snipe'd by Intrexa. Yes, do not use obscene grammar or connotations.
Last edited on
I can't believe I made such a simple error like this! Thanks! I guess I previously did too much programming in one setting??
Last edited on
Please edit your first post and remove the obscenities.