24h購物| | PChome| 登入
2007-10-04 12:02:39| 人氣72| 回應1 | 上一篇 | 下一篇

程式

推薦 0 收藏 0 轉貼0 訂閱站台

#include
#include

int main(void)
{
short si1=-32768, si2=-32769, si3=32767, si4=32768;
unsigned long usi1=0, usi2=65535, usi3=-2, usi4=65537;
long lg1=-2147483648, lg2=2147483647, lg3=-2147483650, lg4=2147483648;




; printf("Data types of C Language:");
printf("1.int(long int)(long)n");
printf("2.short int(short)n");
printf("3.charn");
printf("4.floatn");
printf("5.doublen");

printf("Length of long int is %d:n", sizeof(long));
printf("Length of short int is %d:n", sizeof(short));
printf("Length of char int is %d:n", sizeof(char));
printf("Length of float int is %d:n", sizeof(float));
printf("Length of double int is %d:n",sizeof(double));
//驗證數值儲存範圍
//1. long
//2. unsigned long
//3. short
//4. unsigned short
printf("si1=%d, si2=%d, si3=%d, si4=%dn",si1,si2,si3,si4);
printf("Range of short int is %d ~ %d :n", si1,si3);
printf("usi1=%d, usi2=%d, usi3=%d, usi4=%dn",si1,si2,si3,si4);
printf("lg1=%d, lg2=%d, lgi3=%d, lg4=%dn",lg1,lg2,lg3,lg4);


system("pause");
return 0;

}

台長: ~資管坦克~
人氣(72) | 回應(1)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 不分類

9556004-貝貝拉拉喵喵
這程式好眼熟..?
2007-10-06 21:38:12
版主回應
當然眼熟
是C++的作業阿!!
我還沒寫完ㄉ說...
2007-10-07 11:49:14
是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入圖片中算式的結果(可能為0) 
(有*為必填)
TOP
詳全文