这简单的类错在哪了?

来源:百度知道 编辑:UC知道 时间:2024/05/29 16:09:07
#include <iostream>
using namespace std;
class Price
{private :
int pri;
public:
void set-price()
{cin>>pri;
}
void show-price()
{cout<<pri;
};
};
int main()
{Price cola;
cola.set-price();
cola.show-price();
return 0;
}

void set-price()
函数中不允许有减号-
只允许有字母,数字,下划线,而且数字不能在开头换成下划线 _

另外, return 0;
最后的这一句用了中文分号,换成英文的