一、课堂笔记
1.基本类型数据
2.常量在C语言中是如何表示的
3.printf的使用
4.scanf的使用
二、翻译
| 中文 | 英文 | 中文 | 英文 |
|---|---|---|---|
| 整数 | integer | 变量 | variable |
| 字符 | character | 初始化 | initialization |
| 浮点数 | Floating point number | 十进制 | decimal system |
| 结构体 | structural morphology | 二进制 | Binary |
| 枚举 | enumeration | 十六进制 | hexadecimal |
| 联合 | union | 打印 |
三、课后作业
1、3-10第四题
a. '\b',单引号表示字符类型常量,''表示转义,'\b'表示退格;
b. 1066是一个整数型常量;
c. 99.44表示双精度浮点型数据常量;
d. 0xAA表示十六进制无符号整数类型数据常量;
e. 2.0e30表示双精度浮点型数据常量。
2、3-10第六题
| 常量 | 类型 | 转换说明符 |
|---|---|---|
| 12 | int | %d |
| 0X3 | Unsigned int | %#X |
| ‘C’ | char | %c |
| 2.34E07 | double | %e |
| ‘\040’ | Char | %c |
| 7.0 | Double | %f |
3、3-10第八题
printf("The odds against the %d were %ld to 1.\n",imate,shot);
printf("A score of %f is not an %c grade.\n",log,grade).
4、3-11第一题
1.整数上溢
2.浮点数上溢
3.浮点数下溢
5、3-11第二题
#include <stdio.h>
int main(void)
{
int i = 66;
printf("%c\n", i);
return 0;
}
6、4-8第一题
#include <stdio.h>
int main(void)
{
char name[40];
char surname[40];
printf("Please input your first name:");
scanf("%s",name);
printf("Please input your last name:");
scanf("%s",surname);
printf("%s,%s.",name,surname);
return 0;
}
7、4-8第四题
#include <stdio.h>
int main()
{
float heigh;
char name[40];
printf("Enter your name :");
scanf("%s",name);
printf("%s, how tall you are(inch) :",name);
scanf("%f",&heigh);
printf("%s,you are %.3f feet tall \n",name,heigh/12.0);
return 0;
}
8、4-8第七题
#include <stdio.h>
#include <float.h>
int main(void)
{
double d_third = 1.0 / 3.0;
float f_third = 1.0 / 3.0;
printf("float of one third(6) = %.6f\n",f_third);
printf("float of one third(12) = %.12f\n",f_third);
printf("float of one third(16) = %.16f\n",f_third);
printf("double of one third(6) = %.61f\n",d_third);
printf("double of one third(12) = %.121f\n",d_third);
printf("double of one third(16) = %.161f\n",d_third);
printf("FLT_DIG in float.h is %d\n",FLT_DIG);
printf("DBL_DIG in float.h is %d\n",DBL_DIG);
return 0;
}