注册 登录
编程论坛 C++教室

请高手看一下这个程序!

小编程员 发布于 2009-09-18 01:37, 341 次点击
#include<iostream.h>
#include<iomanip.h>
void main()
{cout<<setfill('*')<<123<<setw(9)<<321;
 cout<<setfill('*')<<setw(6)<<left<<123<<setw(6)<<right<<321;
 cout<<123<<setfill('*')<<setw(6)<<321<<endl;
 cout<<setfill('*')<<setw(9)<<left<<123<<321<<endl;
}
编译器读不懂left与right,请问要加上什么头文件才能使程序正确呢?
2 回复
#2
gz812009-09-18 08:23
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{cout<<setfill('*')<<123<<setw(9)<<321;
cout<<setfill('*')<<setw(6)<<left<<123<<setw(6)<<right<<321;
cout<<123<<setfill('*')<<setw(6)<<321<<endl;
cout<<setfill('*')<<setw(9)<<left<<123<<321<<endl;
}


我试了,这样可以编译通过。

[ 本帖最后由 gz81 于 2009-9-18 08:30 编辑 ]
#3
小编程员2009-09-18 13:17
多谢!我懂了!
1