我在C++写一个转换器形式的意大利lires为欧元:错误:预计','或';'前“{”令牌“和”不能被用作函数
#include <iostream>
using namespace std;
float x;
int converter (x)
{
y = x/1936,27;
return y;
}
int main()
{
cout << "Give me the value: ";
cin >> x;
converter (x);
}
我尝试编译它,我看到了两个错误。第一个是:
lire-euro.cpp:8: error: expected ‘,’ or ‘;’ before ‘{’ token
我在括号之前定义了一个函数。为什么我应该在'{'
之前放','
或3210? 第二个是:
lire-euro.cpp: In function ‘int main()’:
lire-euro.cpp:17: error: ‘converter’ cannot be used as a function
为什么我不能用converter
的功能?这与其他错误有关吗?
第三,虽然不是错误时,'converter'可以改写成'X/1936; int y = 27;'为了清楚起见。 :) – mars
@mars,你是对的。我没有看到有逗号。 –