第二章 声明和使用变量

定义常量

const pi = 3.14 此时pi就是常量了,不是变量,改变不了

cmath 各种计算的函数库 math.h是c语言的,c++中是cmath

cout<< fixed ; 强制以小数表示

cout<< setprecision(2) ; 小数点精度两位

cout << fixed << setprecision(2);    //以小数点后两位形式显示

cout << setw(8) << "|" <<3.14<< "|" << endl ;          // |前留8个空位

getchar ();    //得到用户输入的单个字符

cin.get ();         

猜你喜欢

转载自blog.csdn.net/qq_43069617/article/details/82117475