我在我的代碼得到這個錯誤在編譯 這裏是代碼錯誤:左值要求作爲分配的左操作數,我得到這個錯誤是什麼左值和右值,以及如何消除這種錯誤
#include <iostream>
using namespace std;
int main()
{
int l,n,w,h;
cin>>l>>n;
while(n--){
cin>>w>>h;
if(w>l||h>l)
cout<<"CROP IT"<<endl;
if(w==l&&h==l&&w=h)
cout<<"ACCEPTED"<<endl;
if(w<l||h<l)
cout<<"UPLOAD ANOTHER"<<endl;
}
}
和錯誤
11:22: error: lvalue required as left operand of assignment
這是一個重複的問題。請參閱:http://stackoverflow.com/questions/19973320/error-lvalue-required-as-left-operand-of-assignment-c – Sampath
使用空格鍵會使原因更容易被發現。 – molbdnilo