+ 1

C++ error " Lvalue required as left operand of assignment"

#include <iostream> int main() { std::cout<<"you are trying to break into a secret lab."<<std::endl; std::cout<<"you need to enter 3 digits on a security lockpad."<<std::endl; std::cout<<"the only information you have about the 3 digits is that the sum of the three digits is 9"<<std::endl ; std::cout<<"and that their product is 24.please note that you have to enter the digits from the lowest to the highest"<<std::endl; int CodeA=2; int CodeB=3; int CodeC=4; int Code1; int Code2; int Code3; std::cin>> Code1, Code2, Code3; if(Code1=CodeA&&Code2=CodeB&&Code3=CodeC) { std::cout<<"Success,the door opens!"; } else{ std::cout<<"wrong combination,try again!" ;} return 0; }

12th May 2019, 8:15 PM
armin harper
3 ответов
+ 2
Thank you it worked!
12th May 2019, 9:30 PM
armin harper
+ 1
Im new to both C++ and Solo Learn so i don't know how to properly ask my question, it seems to me that the compiler is expecting the value of code1, 2 and 3 to be predefined whereas i want them to be entered by the user, can anyone tell me what's wrong with my code?
12th May 2019, 8:19 PM
armin harper