LinuxSir.cn,穿越时空的Linuxsir!

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

大家来看一下这个代码,在win32可以编译运行,但是在 redflag4 desktop 却不能编译通过!

[复制链接]
发表于 2005-11-8 16:03:52 | 显示全部楼层 |阅读模式
//Vectors of objects
#include "stdio.h"
class point
{
        private:
                int x1,x2;
                void init(int x, int y)
                {
                        x1=x;
                        x2=y;
                }
        public:
                point(int x, int y){ x1=x; x2=y;}
                point(){ init(0,0);}
                int x_cord(){ return x1;}
                int y_cord(){ return x2;}
};

int main()
{
1        point data(3,4);
2        printf("\n The y coordinate = %d", data.y_cord());
3        point more_data[20];
4        printf("\n The x coordinate of index 18 = %d",more_data[18].x_cord());
        return 0;
}

带标号的4个语句造成的。哪位给讲解一下?偶是新手。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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