流成员函数进行输入输出格式的控制解决方法

流成员函数进行输入输出格式的控制
#include<iostream>
using namespace std;
int main()
{
cout.setf(ios::showpos|ios::scientific);
cout<<567<<" "<<567.89<<endl;
return 0;
}
这个题的编译结果是这样的:+567 +5.678900e+002
想知道showpos使得两个数都添加了“+”,为什么scientific不作用于两个数的,作用难道有顺序?
那如果是这样的cout.setf(ios::showpos|ios::dec|ios::scientific)呢?


------解决方案--------------------
格式控制从不用cout,那是痛苦的代名词。
printf/scanf 强大无比
------解决方案--------------------
探讨
#include<iostream>
using namespace std;
int main()
{
cout.setf(ios::showpos|ios::scientific);
cout<<567<<" "<<567.89<<endl;
return 0;
}
这个题的编译结果是这样的:+567 +5.678900e+002
想知道showpos使得两个数都添加了“+”……

------解决方案--------------------
告别C++ 标准I/O库, 早日脱离苦海。