不明白哪里出了问题,肛入坑
#include <iostream>
int transfrom (int);
int main()
{
using namespace std;
int long;
cout << "Enter the ma in long : ";
cin >> long;
int ma = transfrom (long);
cout << long << "long =";
cout << ma << "ma" << endl;
return 0;
}
int transfrom (int sts)
{
return 220 * sts;
}
只是书中将stone转化pounds的代码,我模仿了一下一直报错,不知道哪里的问题
#include <iostream>
int stonetolb(int);
int main()
{
using namespace std;
int stone;
cout << "Enter the weight in stone: ";
cin >> stone;
int pounds = stonetolb (stone);
cout << stone << "stone = ";
cout << pounds << "pounds." << endl;
return 0;
}
int stonetolb(int sts)
{
return 14 * sts;
}
long是C++关键字,不能拿来作为变量名,改成别的名字。