摘要: 第一题 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define N 5 // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20] 阅读全文
posted @ 2021-12-22 21:22 後海不是海王 阅读(40) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h> #define N 5 int binarySearch(int* x, int n, int item); // 函数声明 int main() { int a[N] = { 2, 7, 19, 45, 66 }; int i, index, key; pri 阅读全文
posted @ 2021-12-15 11:17 後海不是海王 阅读(27) 评论(2) 推荐(0) 编辑
摘要: 第一题 #include <stdio.h> #define N 5 void output(int x[], int n); int main() { int x[N] = { 9, 55, 30, 27, 22 }; int i; int k; // 用于记录最大元素的下标 int t; // 阅读全文
posted @ 2021-12-09 16:22 後海不是海王 阅读(24) 评论(2) 推荐(0) 编辑
摘要: 第一题 #include <stdio.h> const int N = 4; int main() { int a[N] = { 2, 0, 2, 1 }; // 定义一个int型数组a,包含N个元素 char b[N] = { '2', '0', '1', '1' }; // 定义一个char型 阅读全文
posted @ 2021-12-01 11:24 後海不是海王 阅读(30) 评论(2) 推荐(0) 编辑
摘要: 第一题 #include <stdio.h> long long fac(int n); // 函数声明 int main() { int i, n; printf("Enter n: "); scanf_s("%d", &n); for (i = 1; i <= n; ++i) printf("% 阅读全文
posted @ 2021-11-24 13:00 後海不是海王 阅读(32) 评论(2) 推荐(0) 编辑
摘要: 恢复内容开始 第一题 1.%04d是以四位十进制输出,不足的前面补0 第二题 第三题 第四题 第五题 1.可以把%100改成%32 第六题 #include<stdio.h> #include <stdlib.h> #include <time.h> const int N = 1; int mai 阅读全文
posted @ 2021-11-11 09:56 後海不是海王 阅读(22) 评论(3) 推荐(0) 编辑
摘要: 第一题 第二题 因为两次变量r4的数据类型不同 第三题 r1 = n(n+1)/2 r2 = (n+1)n/2 r3 = 0.5n(n+1) r4 = (n+1)/2 *n 因为n是整型变量,会自动取整 第四题 第五题 第六题 去掉后并没有什么不同 结论 1.加深了对于表达式顺序不同造成的结果不同的 阅读全文
posted @ 2021-10-27 16:39 後海不是海王 阅读(13) 评论(1) 推荐(0) 编辑