运算符重载及流类库

来源:百度知道 编辑:UC知道 时间:2024/05/29 13:54:51
完成下面的程序,使其输出为:*****12345 54321*****.源程序如下:
#include <iomanip>
using namespace std;
class FUN{
friend ostream____(ostream&,FUN);
}fun;
ostream____(ostream& os, FUN f)
{
os.setf(ios::left);
return os;
}

void main(){
cout<<setfill('*')<<setw(10)<<12345<<" ";
cout<<fun<<setw(10)<<54321<<endl;
}
两个下划线处填空"______"

大哥,这是填空题,又不是改错题.
================================
operator<< ,这个我试过了,还有 &operator<< ,(13) : error C2065: 'cout' : undeclared identifier
如果再加上#include <iostream>,还是错误,(15) : error C2593: 'operator <<' is ambiguous

两处均为:
&operator<<

此为重载"<<"。

全是错误!改得半天啊

我觉得两个都是“operator<<”吧!头文件少了些,所以一楼你会出现很多错误吧。编译是会出错,error C2593: 'operator <<' is ambiguous,是因为这个<<混淆定义了。哎……我也不知道了