Xcode編譯下,無(wú)法正確給出結(jié)果
#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; }
我的代碼應(yīng)該和老師的是一樣的,但是在Xcode中,會(huì)有如下的提示,不太明白什么意思
2016-03-07
#include<string>