bitcoin diamond:请问这段C++代码那里有错误??

来源:百度文库 编辑:神马品牌网 时间:2024/04/30 00:43:06
#include<iostream.h>

class desk
{
public:
desk();
protected:
int weight;
int height;
int width;
int length;
};

class stool
{
public:
stool();
protected:
int weight;
int height;
int width;
int length;
};

desk::desk()
{
weight=10;
height=5;
width=5;
lenght=5;
cout<<weight<<" "<<height<<" "
<<width<<" "<<lenght<<endl;
}
stool::stool()
{
weight=6;
height=3;
width=3;
lenght=3;
cout<<weight<<" "<<height<<" "
<<width<<" "<<lenght<<endl;
}

void fn()
{
desk da;
stool sa;
}

void main()
{
fn();
}
我改完了,那里还有错误呀...郁闷
#include<iostream.h>

class desk
{
public:
desk();
protected:
int weight;
int height;
int width;
int length;
};

class stool
{
public:
stool();
protected:
int weight;
int height;
int width;
int length;
};

desk::desk()
{
weight=10;
height=5;
width=5;
length=5;
cout<<weight<<" "<<height<<" "
<<width<<" "<<length<<endl;
}
stool::stool()
{
weight=6;
height=3;
width=3;
length=3;
cout<<weight<<" "<<height<<" "
<<width<<" "<<length<<endl;
}

void fn()
{
desk da;
stool sa;
}

void main()
{
fn();
}

错误提示:fatal error C1010: unexpected end of file while looking for precompiled header directive

选工程-设置-选C/C++选项卡-在 分类: 中 选择 预编译的头文件-不使用补偿页眉

死马当活马医~保证是你的编译器设置有问题。因为我运行的时候一切正常

你的length有拼写错误,望改成一样的。

这个代码我试了一下 可以编译运行 没问题啊

把你错误的提示说说看?