Presentation is loading. Please wait.

Presentation is loading. Please wait.

2015年度 プログラミングⅡ ~ 計算してみよう ~.

Similar presentations


Presentation on theme: "2015年度 プログラミングⅡ ~ 計算してみよう ~."— Presentation transcript:

1 2015年度 プログラミングⅡ ~ 計算してみよう ~

2 データ型の種類 種類 データ型(略式) データ型(正式) 文字 char signed char unsigned char
左同(省略不可) 整数 short signed short int unsigned short unsigned short int int signed int unsigned int long signed long int unsigned long unsigned long int long long signed long long int unsigned long long unsigned long long int 浮動小数点数 float double long double

3 各データ型の表現可能な値 種類 データ型 表現可能な値 バイト数 文字 char -128 ~ 127 1 unsigned char
0 ~ 255 整数 short ~ 32677 2 unsigned short 0 ~ 65535 int 4 unsigned int 0 ~ long unsigned long long long 8 unsigned long long 0 ~ 浮動小数点数 float 10-37 ~ 1038 (仮数部の有効桁数:7桁) double ~ (仮数部の有効桁数:15桁) long double ~ (仮数部の有効桁数:19桁) 10

4 データ型に関する注意事項(1) short ≦ int ≦ long ≦ long long 整数を表す型の数は巡回する
-1

5 データ型に関する注意事項(2) float ≦ double ≦ long double 浮動小数点数(IEEE754)は有効桁数に注意
符号部 1ビット 指数部 8ビット 11ビット 15ビット 仮数部 23ビット (実質24ビット) 52ビット (実質53ビット) 64ビット (実質65ビット) 合計 32ビット (4バイト) (8バイト) 80ビット (10バイト)

6 文字列入力にはアドレスを表す「&」を付けない
入力と出力についてのまとめ printf scanf 解説 char %c 1文字 %s 文字列(末尾に「\0」) int %d 10進数 double %f(%lf) %lf 例: %e(%E) 例:1.2345e+2 %g(%G) 自動で%fまたは%e 文字列入力にはアドレスを表す「&」を付けない scanf(“%s”, string) ○ scanf(“%s”, &string) ×


Download ppt "2015年度 プログラミングⅡ ~ 計算してみよう ~."

Similar presentations


Ads by Google