为什么输出结果会乱码
#include<iostream>
#include<stdlib.h>
using namespace std;
class Teacher
{
public:
void setname(string name);
string getname();
void setgender(string gender);
string getgender();
void setage(int age);
int getage();
void teach();
private:
string m_strname;
string m_strgender;
int m_iage;
};
void Teacher::setname(string name)
{
m_strname=name;
}
string Teacher::getname()
{
return m_strname;
}
void Teacher::setgender(string gender)
{
m_strgender=gender;
}
string Teacher::getgender()
{
return m_strgender;
}
void Teacher::setage(int age)
{
m_iage=age;
}
int Teacher::getage()
{
return m_iage;
}
void Teacher::teach()
{
cout<<"现在上课"<<endl;
}
int main()
{
Teacher t;
t.setname("孔子");
t.setgender("男");
t.setage(30);
cout<<t.getname()<<" "<<t.getage()<<" "<<t.getgender()<<endl;
system("pause");
return 0;
}
为什么结果会出现这种情况
瀛斿瓙 30 鐢
请按任意键继续. . .