- 博客(8)
- 收藏
- 关注
原创 c primerplus 第十章编程题答案
//第一题 #include <stdio.h> #include <stdlib.h> #define MONTHS 12 #define YEARS 5 int main(void) { const float rain[YEARS][MONTHS] = { { 4.3, 4.3, 4.3, 3.0, 2.0, 1.2, 0.2, 0.2, 0.4, 2.4, 3.5, 6.6 }, { 8.5, 8.2, 1.2,
2020-08-03 23:47:02 747
原创 c primer plus第九章习题
//第一题 #include <stdio.h> double h(double a, double b); int main(void) { double min, a, b; scanf("%lf %lf", &a, &b); min = h(a, b); printf("%f\n", min); return 0; } double h(double a, double b){ if(a >= b) return b; else
2020-07-25 16:44:05 250
原创 c primer plus 第七章笔记+习题
//第一题 #include <stdio.h> int main(void) { char ch; int blank = 0, line_feed = 0, other = 0; while((ch = getchar())!='#'){ if(ch == ' ') blank++; else if(ch == '\n') line_feed++; else other++; } printf("blank = %d, l.
2020-07-21 16:40:21 771
原创 c primer plus第六章笔记+习题
1、 ```c #include <stdio.h> int main(void) { char alpha[26] = {'a', 'b', 'c'}; //懒得写了 int i; for(i = 0; i < 26; i++) printf("%c ", alpha[i]); return 0; } 2、 #include <stdio.h> int main(void) { int i, j; for(
2020-07-18 11:18:35 808
原创 c primer plus第五章笔记+习题
****1、 #include <stdio.h> int main(void) { int n, h, m; const int a = 60; printf("请输入大于0的分钟数\n"); scanf("%d", &n); while(n > 0){ h = n / a; m = n % a; printf("%d是%d小时%d分钟\n", n, h, m); scanf("%d", &n); //如果不加这行,就会一直循环 } retu
2020-07-16 12:16:42 249
原创 c primer plus第四章笔记+习题
printf(“%2.2f”, 2.345e2); //输出234.50 输出一个左对齐、字符宽度为6、最少有4位数字的十进制整数 %-6.4d //转换说明中小数点前的数字指明字段宽度,小数点后的数字指明精度 输出一个形如0x8a、字段宽度为4的十六进制整数 %#4x **1、#include <stdio.h> #include <string.h> int main(void) { char ming[40], xing[40]; printf(“请输入名和姓\n”);
2020-07-15 21:11:50 957
原创 C primer plus第三章笔记+习题
单精度float,在32位机器上用4个字节来存储的;双精度double是用8个字节来存储的。 浮点数后加F\f,程序会将类型视为float long long int简写为long long bool函数,true 1/ false 0 赋值①定义时同时初始化 ②运行过程中赋值 ③scanf 1、#include <stdio.h> int main(void) { int a = 99999999999999999999999999999999999999999999999999999999.
2020-07-15 21:08:53 1853
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人