书本3

1:ASCII #include<stdio.h> #include<stdlib.h> int main() { char ASCII; printf("请输入一个ASCII值:"); scanf("%d", &ASCII); printf("对应的ASCII值为%c", ASCII); system("pause"); return 0; } 2:计数法 #include<stdio.h> #include<stdlib.h> int main() { float a; printf("Enter a floating-point value:"); scanf("%f", &a); printf("fixed-point notation:%.6f\n", a); printf("exponential notation:%e\n",a); printf("p notation:%a", a); system("pause"); return 0; } 3:警报 #include<stdio.h> #include<stdlib.h> int main() { putchar('\a'); printf("Startled by the sudden sound, Sally shouted,\n"); printf("“By the Great Punpkin,what was that!”"); system("pause"); return 0; } 4:年换秒 #include<stdio.h> #include<stdlib.h> #include<math.h> int main() { float a, b; printf("请输入你的年龄:"); scanf("%f", &a); b = 3.156 * pow(10, 7) * a; printf("年龄对应的秒数为%f", b); system("pause"); return 0; } 5:身高转换 #include<stdio.h> #include<stdlib.h> int main() { float inch, cm; printf("请输入你的英尺身高:"); scanf("%f", &inch); cm = inch / 2.54; printf("你的身高是%f厘米", cm); system("pause"); return 0; } 6:水分子数 #include<stdio.h> #include<stdlib.h> #include<math.h> int main() { float kt, fz; printf("请输入水的夸脱数:"); scanf("%f", &kt); fz = kt * 950 /3 / pow(10, -23); printf("对应的水分子数量为%f", fz); system("pause"); return 0; } 8:体积变化 #include<stdio.h> #include<stdlib.h> int main() { float p, b, a, t, c; printf("请输入杯数:"); scanf("%f", &b); p = 2 * b; a = b / 8; t = b / 16; c = b / 48; printf("对应的为%f品脱", p); printf("对应的为%f盎司", a); printf("对应的为%f大汤匙", t); printf("对应的为%f茶勺", c); system("pause"); return 0; }io

相关文章
相关标签/搜索