#include<iostream>
using namespace std;
int main()
{
cout<<"52U ====>"<<52U<<endl; //後面加U=uing int
cout<<"75.35L ===>"<<75.35L<<endl; //後面加L或l=long
cout<<"5.7F ===>"<<5.7F<<endl; //後面加F或f=flot
cout<<"4.37E7 ===>"<<4.37E7<<endl; //E=double
cout<<"4.37E+7 ===>"<<4.37E+7<<endl; //E=double +號,如上一行顯示+號可省略
cout<<"4.37E-7 ===>"<<4.37E-7<<endl; //E=double -號,不可省略
cout<<"056 ===>"<<056<<endl; //前面加0=8進位運算
cout<<"056 ===>"<<0x56<<endl; //前面加0x=16進位運算
system("pause");
return 0;
}
結果輸出:
52U ====>52
75.35L ===>75.35
5.7F ===>5.7
4.37E7 ===>4.37e+007
4.37E+7 ===>4.37e+007
4.37E-7 ===>4.37e-007
056 ===>46
056 ===>86
請按任意鍵繼續 . . .
原本是在最前面開始宣告變數,而這樣等於是直接在數字後面宣告這個數字是什麼樣的變數值。