编译器与语言,誰之过
#include <iostream>
#include <string>
using namespace std;
class Student
{
public:
Student(int n = 1,char na[10] = "zhang",char s='m')
{
num = n;
strcmp(name,na);
sex = s;
cout << " the start ~! " << endl;
}
~Student()
{
cout << " the end ~! " << endl;
}
void display();
private:
int num;
char name[10];
char sex;
};
void Student::display()
{
cout << "num : " << num << endl;
cout << "name : " << name << endl;
cout << "sex : " << sex << endl;
}
void main()
{
Student s;
s.display();
}
对于这个程序,我不知道是不是编译器的问题,望各位师哥师姐指点一二。
谢谢