判斷資料型別(10分) C語言基礎

2021-10-07 19:08:58 字數 844 閱讀 8326

description

假設現在你要判斷資料型別是否為int、long long、double,輸入n個字串,請你判斷其代表的資料型別是什麼,且輸入的每個字串保證是正數,且是這三種型別的一種。

input

第一行乙個整數n。(n<=10)

接下來n行每行乙個字串s。(|s|<=10)

output

對於每個字串s,輸出「int」或「long long」或「double」。

sample input 1 

3

129999999999

123.44

sample output 1

int

long long

double

解析:感謝qsh哈哈哈。

#include #include //#include //#include //#include //#include //#include //#include //#include //#include //#include //using namespace std;

#define inf 0x3f3f3f3f

char a[100000];

int main()

}if(flag==1)printf("double\n");

else

if(sb == 1) x *= -1;

if(x > 2147483647 || x < -2147483648)printf("long long\n");

else printf("int\n");}}

return 0;

}

c語言基礎 資料型別

c語言中有四種基本資料型別 整型 浮點型 指標和聚合型別 陣列和結構等 其他型別由此四種派生而成。1 整數型別 整型包含 字元 char 整型 int 長整型 long 和短整型 short 都分為有符號 signed 和無符號 unsigned 兩種。按位數有short int long,其中sh...

c語言基礎 資料型別

c語言基本資料型別大體上分為 整型 和 浮點型 位元組 計算機中最小的儲存單位 1 byte 8 bit 整型 int 4 short 2 long 4或者8 char 1 浮點型 float 4 double 8 常量 程式執行過程中,值不能被改變的量 常量分為 整型常量.浮點型常量.字元型常量 ...

C語言基礎 資料型別

基本型別就是我們在使用c語言時最基礎的資料型別,包括整形 短整型,基本整型,長整型 字元型 浮點型 單 雙精度 以及列舉型別。在程式設計的過程中只使用基本型別是遠遠不夠的,為了滿足需求,因此還要使用基本型別之外的型別,構造型別就是其中的一種。構造型別可以使用基本型別構造出新的資料型別來滿足實際開發中...