首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

为啥会出现:fatal error C1004: unexpected end of file found

2013-09-24 
为什么会出现:fatal error C1004: unexpected end of file found我的源程序如下,刚开始学习C++,请大家帮忙

为什么会出现:fatal error C1004: unexpected end of file found
我的源程序如下,刚开始学习C++,请大家帮忙看看。
#include <string>
#include <iostream>

using namespace std;
class Student
{
public:
Student(int n,string nam,char s)
{
num=n;
name=nam;
sex=s;
cout<<"Constructor called."<<endl;
}
~Student()
{
cout<<"Destructor called."<<endl;

}
void display()
{
cout<<"num:"<<num<<endl;
cout<<"name:"<<name<<endl;
cout<<"sex:"<<sex<<endl<<endl;
private:
int num;
char name[10];
char sex;


};



int main()
{
Student stud1(10010,"Wang_li",'f');
stud1.display();
Student stud2(10011,"Zhang_fun",'m');
stud2.display();
return 0;
}
} c++ class
[解决办法]
你的这个大括号是什么情况????
[解决办法]
class结尾没有;
[解决办法]

#include <string>
#include <iostream>

using namespace std;
class Student
{
public:
Student(int n,string nam,char s)
{
num=n;
name=nam;
sex=s;
cout<<"Constructor called."<<endl;
}
~Student()
{
cout<<"Destructor called."<<endl;

}
void display()
{
cout<<"num:"<<num<<endl;
cout<<"name:"<<name<<endl;
cout<<"sex:"<<sex<<endl<<endl;

}//这里display差括号

private:
int num;
//char name[10];
string name;      //构造函数里是string
char sex;


};



int main()
{
Student stud1(10010,"Wang_li",'f');
stud1.display();
Student stud2(10011,"Zhang_fun",'m');
stud2.display();
return 0;
}
//}这个括号干嘛的? 



[解决办法]
这个比较难,haihao

热点排行