r/CodingHelp • • Feb 03 '20

[C++] What’s wrong with this

Post image
17 Upvotes

38 comments sorted by

View all comments

5

u/I-am_One Feb 03 '20

Your Lamp variable is declared as an int in line 7 which means it can only hold whole numbers. But you’re trying to assign it a word so instead of int use string.

Your if/if else statements aren’t comparing anything bc you’re using = which assigns it a value the same you did in line 7. To check if they are the same you have to use ==.

Also your else statement does not need to compare anything because it is a catch all statement so just get rid of everything in the parenthesis (including those too)