问一个c++的问题

来源:百度知道 编辑:UC知道 时间:2024/06/04 23:09:39
turbo c++3.0 好象识别不了using namespace std;为什么
还有以下程序:
#include<fstream.h>
#include<stdlib.h>
#include<iostream.h>
int main()
{
ifstream in_stream;
ofstream out_stream;
in_stream.open("input.txt",ios::app);
if(in_stream.fail())
{cout<<"Input file opening failed.\n" ;
exit(1);
}
out_stream.open("output.txt",ios::app);
if(out_stream.fail())
{cout<<"Output file opening failed.\n";
exit(1);
}

int first,second,third;
cin>>first>>second>>third;
out_stream<<"the sum of the three is"
<<first+second+third;
cout<< first+second+third;
in_stream.close();
out_stream.close();
return 0;
}
怎么不能在output.txt(以建立)中看到输出
各位大侠 请为我指点迷津

tc 3.0好像是九十年代中期出现的,而标准是98年出的,那时C++标准没有名字空间,头文件都有.h后缀,后来标准的都没有后缀了,如<fstream>, <cstdio>就是在fstream.h, stdio.h加了名字空间std,名字空间类似于java的包,有利于避免不同厂商开发时库时的命名冲空,std中标准C++的名字空间。
第二看不出原因,在我机器上能产生输出,是不是你在调试时看的,stream通常在close, flush时才将缓存输出。

学习一下了!哈哈,好像不错的答案哦!