-
-
-
-
-
-
-
-
-
-
-
- #include <iostream>
- #include <iomanip>
- using namespace std;
-
- int main()
- {int a=34;
- cout<<"hex:"<<hex<<a<<endl;
- cout<<"oct:"<<setbase(8)<<a<<endl;
- cout<<"dec:"<<dec<<a<<endl;
- char *pt="China";
- cout<<setw(10)<<pt<<endl;
- cout<<setfill('*')<<setw(10)<<pt<<endl;
- double d=225.0/7.0;
- cout<<"d="<<d<<endl;
- cout<<"d="<<setprecision(4)<<d<<endl;
- cout<<"d="<<setprecision(5)<<d<<endl;
- cout<<setprecision(5)<<d<<endl;
-
- return 0;
-
- }
/*
* Copyright (c) 2014, 烟台大学计算机学院
* All rights reserved.
* 文件名称:Project4.cpp
* 作 者:宋健
* 完成日期:2014年11月2日
* 版 本 号:v1.0
*
* 问题描述:初次熟悉控制符号的作用
* 输入描述:
* 程序输出:
*/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{int a=34;
cout<<"hex:"<<hex<<a<<endl;
cout<<"oct:"<<setbase(8)<<a<<endl;
cout<<"dec:"<<dec<<a<<endl;
char *pt="China";
cout<<setw(10)<<pt<<endl;
cout<<setfill('*')<<setw(10)<<pt<<endl;
double d=225.0/7.0;
cout<<"d="<<d<<endl;
cout<<"d="<<setprecision(4)<<d<<endl;
cout<<"d="<<setprecision(5)<<d<<endl;
cout<<setprecision(5)<<d<<endl;
return 0;
}