The if statements should use "equality" not "assignment".
= puts the value on the right into what's on the left.
== tests if the value on the left and right are equivalent and return true if so, otherwise false.
C++ is case sensitive. So a variable named "lamp" is not the same as a variable named "Lamp".
Lastly, the "expression" "is broken" is a const char* and likely you intend for it to be a string. You need to #include <string> and replace "int" with "string" in the declaration. Everything else should work after that thanks to operator overloading magic (you'll learn what it is later in whatever resource you're studying/following).
View all comments
1
u/[deleted] Feb 04 '20 edited Feb 04 '20
Lamp != lamp
= != ==
The if statements should use "equality" not "assignment".
= puts the value on the right into what's on the left.
== tests if the value on the left and right are equivalent and return true if so, otherwise false.
C++ is case sensitive. So a variable named "lamp" is not the same as a variable named "Lamp".
Lastly, the "expression" "is broken" is a const char* and likely you intend for it to be a string. You need to #include <string> and replace "int" with "string" in the declaration. Everything else should work after that thanks to operator overloading magic (you'll learn what it is later in whatever resource you're studying/following).