| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 740 人关注过本帖
标题:关于 iostream 的几个小问题
取消只看楼主 加入收藏
盆中线
Rank: 1
等 级:新手上路
帖 子:48
专家分:0
注 册:2008-11-6
结帖率:100%
收藏
 问题点数:0 回复次数:1 
关于 iostream 的几个小问题
虽然知道在C++里面要用#include  <iostream>
                     using namespace std;
但不知道以下一个问题的到底是为什么

1
如果我建一个工程,然后在不同的.CPP文件里面用着两种形式
#include  "iostream.h"
在main函数里面用的是:#include  "iostream"
                      using namespace std;
不是按道理来说,这两种是不能混用么?如果把“”改成了<>编译就无法通过了,可是如果是“”就能通过也能运行。。谁能告诉我为什么呢?~~~

2
关于  ERROR:unexpected file found end
老师说,是因为C++里面有一个预定义函数头(?我记不清楚了。。)所以在我编译的MAIN函数末尾会出现这个错误。然后就把那个功能去掉吧。。可是还是不能。请看看程序的调用部分吧
#include  <iosteam>
using namespace std;
#include  "animal.h"
#include  "dog.h"
int main(){
......
}
我就把它改成了
#include  "animal.h"
#include  "dog.h"
#include  <iosteam>
using namespace std;

int main(){
......
}
改动了下iostream的位置,那个问题就解决了。。。の。。这个是为什么呢~~~~
搜索更多相关主题的帖子: iostream 
2008-11-14 17:29
盆中线
Rank: 1
等 级:新手上路
帖 子:48
专家分:0
注 册:2008-11-6
收藏
得分:0 
文件一

#include  "animal.h"
#ifndef dog_class
#define dog_class
class dog:public animal{
public:
    void SetAge(int n)
    {
        age=n;
        cout<<"Dog age is "<<n<<endl;
    }
};
#endif

文件2

#ifndef  animal_class
#define  animal_class
class animal{
public:
    int age;
    animal(){}
    ~animal(){}
};
#endif

#include  "iostream"
using namespace std;
#include  "animal.h"
#include  "dog.h"
int main(){
    dog D;
    D.SetAge(3);
    return 0;
}
这样子就会报错,然后改变iostream的位置就没有错了。。请大侠再看看吧
2008-11-15 19:53
快速回复:关于 iostream 的几个小问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015868 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved