【发布时间】:2019-10-13 01:11:10
【问题描述】:
得到表达式必须是一个可修改的左值错误,我看了其他帖子仍然没有意义:/尝试制作简单的温度转换器。
1>C:\Users\whatsupnigeh\Desktop\Stuff\asmgodtm\Temperature_Converter\Temperature_Converter\Main.cpp(30,30):错误 C2106:'=':左操作数必须是左值
#include <iostream>
#include <Windows.h>
#include <math.h>
using namespace std;
float final_temp;
int main()
{
SetConsoleTitleA("Temperature Converter");
cout << "{1} Fahrenheit -> Celsius" << endl;
cout << "{2} Celsius -> Fahrenheit" << endl << endl;
cout << "Selection: " << endl;
int choice;
cin >> choice;
if (choice == 1)
{
cout << "Enter F*: " << endl << endl;
float f;
cin >> f;
f - 32 * 5 / 9 = final_temp;
cout << final_temp;
}
if (choice == 2)
{
cout << "Enter C*: " << endl << endl;
float c;
cin >> c;
c * 9 / 5 + 32 = final_temp;
cout << final_temp;
}
else
{
return 0;
}
Sleep(3000);
return 0;
}
【问题讨论】:
-
f - 32 * 5 / 9 = final_temp;-->final_temp = f - 32 * 5 / 9;
标签: c++