C++整数输出8位不足补0

头文件:<iomanip>

函数:setw(int n)

函数:setfill(char c)

cout<<setw(8)<<setfill('0')<<123<<endl;

输出:00000123

 

C语言

printf("%08d \n",123);

输出:00000123

posted @ 2019-10-17 14:15  huhuahope  阅读(2313)  评论(0编辑  收藏  举报