DEV C++出现问题~

来源:百度知道 编辑:UC知道 时间:2024/05/12 14:48:09
如果头文件是用
#include<iostream>
#include<iomanip>

会提示你 cout,setw,setprecision未定义
而如果是用#include<iostream.h>
#include<iomanip.h>
则出现#warning This file includes at least one deprecated or antiquated header. \
Please consider using one of the 32 headers found in section 17.4.1.2 of the \
C++ standard. Examples include substituting the <X> header for the <X.h> \
header for C++ includes, or <iostream> instead of the deprecated header \
<iostream.h>.
请教高手
哦 能告诉我为啥一定要写名字空间么 貌似这段代码在别人机器上正常。。。他们是用VC的

有人要求严格遵守标准,有的可以适当放松,不同编译器不同

#include<iostream>
#include<iomanip>
use namespace std;

或者
#include<iostream.h>
#include<iomanip.h>

或者
#include<iostream>
#include<iomanip>
...
std::cout<<...

请检查你的格式。
std::cout
你的代码中若直接写cout << .... <<..就会提示 cout 未定义。

这个的确和编译器有关。
楼上的正解。。。。。。。。。。。。。