mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-05-11 10:35:32 +08:00
support bazel complie this project and format code.
This commit is contained in:
20
practical_exercises/10_day_practice/day10/file/12-5.cpp
Normal file
20
practical_exercises/10_day_practice/day10/file/12-5.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
// Eg12-5.cpp
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main() {
|
||||
char c[30] = "this is string";
|
||||
double d = -1234.8976;
|
||||
cout << setw(30) << left << setfill('*') << c << "----L1" << endl;
|
||||
cout << setw(30) << right << setfill('*') << c << "----L2" << endl;
|
||||
// showbase显示数值的基数前缀
|
||||
cout << dec << showbase << showpoint << setw(30) << d << "----L3"
|
||||
<< "\n";
|
||||
// showpoint显示小数点
|
||||
cout << setw(30) << showpoint << setprecision(10) << d << "----L4"
|
||||
<< "\n";
|
||||
// setbase(8)设置八进制
|
||||
cout << setw(30) << setbase(16) << 100 << "----L5"
|
||||
<< "\n";
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user