cin 例子
int x,y;
cin >> x;
string s1, s2;
cout<<"请输入两个字符串:\n";
cin >> s1 >> s2;
char c;
cin >> c;
char c;
c = cin.get();
char buffer[80];
for(int k=0; k<10; k++)
{ cin>>buffer[k]; }
buffer[10]=‘\0’;
cin>>buffer;
cin.getline(buffer, 80, '\n');
cout 例子
#include <iomanip>
cout<<setw (8)<<'a'<<setw (8)<<'b'<<endl;
cout<<setfill ('*')<<setw (8)<<'a'<<setw (8)<<'b'<<endl;
cout<<setiosflags (ios::left)<<setfill ('*')<<setw (8)<<'a'<<setw (8)<<'b'<<endl;
double f=177/7.0;
cout<<f<<endl;
cout<<setprecision(3)<<f<<endl;
cout<<setiosflags (ios::fixed) <<setprecision(3)<<f<<endl;
cout<<setiosflags (ios::scientific) <<setprecision(3)<<f<<endl;