LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 618|回复: 1

最简单的编译测设竟然有误,大家运行一下试试!!

[复制链接]
发表于 2007-3-15 21:37:25 | 显示全部楼层 |阅读模式
#include <iostream>
using namespace std;
class Printer
{
  private:
    int Serial_Number;
  public:
    void Hello()
   {
   char name[10];
   cout <<"please input your name :" <<endl;
   cin>>name;
   cout<<"hello c++"<<endl;
   cout<<"my name is"<<name<<"."<<endl;
   }
}                                                                              
int main(void)
{
  Printer My_Printer;
  My_Printer.Hello();
  return 0;
}
---------------------------------
编译提示 :
[root@xunil ~]# g++ hello.cpp
hello.cpp:17: error: new types may not be defined in a return type
hello.cpp:17: note: (perhaps a semicolon is missing after the definition of ‘Printer’)
hello.cpp:17: error: two or more data types in declaration of ‘main’
hello.cpp:17: error: ‘::main’ must return ‘int’
难道 return 0,不是返回 整数吗?大家帮我指点一下 !
发表于 2007-3-15 21:56:14 | 显示全部楼层
class XXXX
{
};       // 注意分号
PS:以后贴代码的是后用[noparse][code][/code][/noparse]括起来
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表