操作系统:Windows 98/XP/2000
编程工具:Visual C++ 6.0/7.0
问题:VC++ 6.0中的流是老版本,例如
cout<<left<<setw(12)<<n;
这样的语句就无法通过编译(但采用新标准的C++Builder4.0就能够通过)。我的问题是:
(1)是否有办法在VC++ 6.0中使用新标准的流?
(2)VC++.Net(VC++ 7.0)声称已经支持新标准的流,通过下面的程序也得到证实:
#include<iomanip.h>
void main(){
cout<<left<<setw(10)<<99;
}
此程序未能通过7.0编译,但显示如下信息:
d:\Program Files\Microsoft Visual Studio .NET\Vc7\include\useoldio.h(29): warning C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma deprecated
根据提示,我打开了useoldio.h文件,其中有如下的说明文字:
Warning C4995, '_OLD_IOSTREAMS_ARE_DEPRECATED' is a deprecated name, is being issued because the old I/O Streams headers iostreams.h et al will no longer be supported from VC8. Replace references such as #include <iostreams.h> with #include <iostreams>, using the new, more conformant, I/O Streams headers.
遵循这样提示,我将程序中的
#include<iomanip.h>
改为
#include<iomanip>
仍未能通过编译,程序中left,setw,<<,cout等都不识别。经检查,确有名为iomanip的文件,#include<iomanip>是成功执行的。如何能在VC++ 7.0中使用新标准的流?
水平: 中级(Li Ning)
