我是一個初學者編程,我目前正在嘗試做一個轉換程序,從千克到磅,反之亦然。我不擅長閱讀錯誤代碼,所以有人可以告訴我,我做錯了什麼。C++錯誤:無效操作數的類型'雙'和<未解析的重載函數類型'二進制'操作員'
#include <iostream>
using namespace std;
int main()
{
char response;
double Kilo_const = 0.45, Pound_const = 2.20, Kilo_output, Pound_output;
double Kilo_input, Pound_input;
cout << "Choose the input unit \nk = kilo and p = pound" << endl;
cin >> response;
if (response == 'k'){
cin >> Kilo_input;
cout << Pound_output = Kilo_input * Pound_const << endl;
}
else (response == 'p'){
cin >> Pound_input;
cout << Kilo_output = Pound_input * Kilo_const << endl;
}
return 0;
}
請張貼錯誤消息 – Nidhoegger