//--《C++捷径教程》读书笔记--Chapter 18--C++的I/O系统
//--Chapter 18--C++的I/O系统
//--10/15/2006 Sun.
//--Computer Lab
//--Liwei
//说明操控符I/O--7
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout<<setprecision(2)<<1000.243<<endl<<ends<<"aaa"<<endl;
cout<<setw(20)<<"hello xwlee."<<endl;
return 0;
}
//说明操控符I/O--8
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout<<setiosflags(ios::showpos);
cout<<setiosflags(ios::scientific);
cout<<123<<" "<<123.23<<endl;
return 0;
}
//说明操控符I/O--9
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
char s[80];
cin>>ws>>s;
cout<<s<<endl;
return 0;
}
//说明操控符I/O--10
#include <iostream>
#include <iomanip>
using namespace std;
ostream &setup(ostream &stream)
{
stream.setf(ios::right);
stream<<setw(10)<<setfill('$');
return stream;
}
int main()
{
cout<<10<<endl<<setup<<10<<endl;
return 0;
}
//说明操控符I/O--11
#include <iostream>
#include <iomanip>
using namespace std;
istream &prompt(istream &stream)
{
cin>>hex;
cout<<"Enter number using hex format:";
return stream;
}
int main()
{
int i;
cin>>prompt>>i;
cout<<i;
return 0;
}