MSB600 "CL.exe"已退出,代码2
#include <string>
#include <iostream>
#include <stdlib.h>
using namespace std;
class Student
{
public:
void setName(string _name)
{
m_strName = _name;
}
string getName()
{
return m_strName;
}
void setGender(string _gender)
{
m_strGender = _gender;
}
string getGender()
{
return m_strGender;
}
int getScore()
{
return m_iScore;
}
int initScore()
{
m_iScore = 0;
}
int study(int _score)
{
m_iScore = _score + m_iScore;
}
private:
string m_strName;
string m_strGender;
int m_iScore = 0;
};
int main()
{
Student stu;
stu.initScore();
stu.setName("zhangsan");
stu.setGender("female");
stu.study(6);
stu.study(5);
cout << stu.getName() << " " << stu.getGender() << " " << stu.getScore() << endl;
system("pause");
return 0;
}