赋值错误的左操作数需要左值
Lvalue required as left operand of asignment error
这个问题已经被其他人回答过了,但是我不知道如何将它应用到我的代码中,因为,坦率地说,它太简单了。
#include <iostream>
#include <string>
using namespace std;
int pythagorean ()
int a;
int b;
int c;
cout << "A: ";
cin >> a;
cout << "B; ";
cin >> b;
a*=a;
b*=b;
a+b=c; //This is where I get the error. Any ideas?
cout << c;
return 0;
}
你想设置c
,所以它必须是
c = a+b;
a+b
是一个表达式,不是一个可以赋值的变量。
左边是a+b
,它不是一个可赋值的变量(lvalue)
相关文章:
- 需要左键作为赋值的左操作数?? 在链表中添加Add_End、删除和Delete_Front?
- 作为赋值(增加引用变量)C++的左操作数所需的左值
- C++ - 左操作数作为赋值的左操作数
- 当我尝试构建此程序时,出现此错误:需要左键作为赋值的左操作数
- 添加数组元素:需要左键作为赋值的左操作数
- 对条件表达式结果的赋值(其中第二个和第三个操作数是相同类型和值类别的变量)是否仍然存在?
- 在 c 程序中需要左操作数作为赋值的左操作数
- 基本类型变量的赋值计算序列,右操作数引发异常
- 需要左值作为赋值错误的左操作数通过 if 语句
- 在 C++ 中需要左键作为赋值错误的左操作数
- 错误:左值需要作为赋值的左操作数
- 强制函数仅作为赋值操作数调用
- Geany c++,错误为“赋值的左操作数需要左值”
- 运算符重载所需的左值作为赋值的左操作数
- 气泡排序中赋值c++的左操作数需要左值
- 错误:使用四进制和随机数生成器进行赋值时,左值需要作为左操作数
- 不能赋值:左键需要作为赋值的左操作数
- 错误:左值需要作为赋值 C++ 的左操作数
- 左值需要作为赋值的左操作数(while 循环)
- 左键需要作为赋值的左操作数?查看其他线程无济于事