1 #include <iostream> 2 #include <iomanip> 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 4 using namespace std; 5 int main(int argc, char** argv) { 6 int a; 7 cout<<"input a:"; 8 cin>>a; 9 cout<<"dec:"<<dec<<a<<endl; 10 cout<<"hex:"<<hex<<a<<endl; 11 cout<<"oct:"<<setbase(8)<<a<<endl; 12 char *pt="China"; 13 cout <<setw(10)<<pt<<endl; 14 cout <<setfill('*')<<setw(10)<<pt<<endl; 15 double pi=22/7; 16 cout<<setiosflags(ios::scientific)<<setprecision(8); 17 cout<<"pi="<<pi<<endl; 18 cout<<"pi="<<setprecision(4)<<pi<<endl; 19 cout<<"pi="<<setiosflags(ios::fixed)<<pi<<endl; 20 return 0; 21 }