Xcode编译下,无法正确给出结果
#include <iostream>
#include <string.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;
}
void initScore(){
m_iScore = 0;
}
void study(int _score){
m_iScore += _score;
}
private:
string m_strName;
string m_strGender;
int m_iScore;
};
int main(int argc, const char * argv[]) {
// insert code here...
cout << "Hello, World!\n";
Student stu;
stu.initScore();
stu.setName("zhangsan");
stu.setGender("女");
stu.study(5);
stu.study(3);
cout << stu.getName() << " " << stu.getGender() << " " << stu.getScore() << endl;
return 0;
}我的代码应该和老师的是一样的,但是在Xcode中,会有如下的提示,不太明白什么意思