2021年12月24日

实验七

摘要: 实验七 任务1 #include <stdio.h> #define N 5 // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20]; int score; } STU; // 函数声明 阅读全文

posted @ 2021-12-24 22:08 彭涌涛 阅读(41) 评论(2) 推荐(0) 编辑

2021年12月15日

实验六

摘要: 任务一 #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; p 阅读全文

posted @ 2021-12-15 10:59 彭涌涛 阅读(47) 评论(1) 推荐(0) 编辑

2021年12月9日

实验5

摘要: 任务一 task 1_1 #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 阅读全文

posted @ 2021-12-09 23:12 彭涌涛 阅读(16) 评论(1) 推荐(0) 编辑

2021年12月2日

实验四

摘要: 任务1 task1_1 #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'}; // 定义一个ch 阅读全文

posted @ 2021-12-02 21:11 彭涌涛 阅读(16) 评论(1) 推荐(0) 编辑

2021年11月25日

汉诺塔问题(递归)

摘要: 一.问题 如下图所示,从左到右有A、B、C三根柱子,其中A柱子上面有从小叠到大的n个圆盘,现要求将A柱子上的圆盘移到C柱子上去,期间只有一个原则:一次只能移到一个盘子且大盘子不能在小盘子上面,求移动的步骤和移动的次数 二.算法思路 将A柱子上的较大的n-1个盘子暂时移到B柱子上 A柱子只剩下最大的盘 阅读全文

posted @ 2021-11-25 20:02 彭涌涛 阅读(87) 评论(0) 推荐(1) 编辑

2021年11月24日

实验三

摘要: 任务1 task1.1 源代码 #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 11:09 彭涌涛 阅读(48) 评论(1) 推荐(0) 编辑

2021年11月10日

实验二

摘要: 任务一 #include<stdio.h> int main() { int num; scanf_s("%d", &num); printf("2049%04d\n", num); scanf_s("%d", &num); printf("2049%04d\n", num); scanf_s("% 阅读全文

posted @ 2021-11-10 20:38 彭涌涛 阅读(54) 评论(2) 推荐(0) 编辑

2021年10月28日

实验一

摘要: #include<stdio.h> int main() { printf(" O \n"); printf("<H>\n"); printf("I I\n\n"); printf(" O \n"); printf("<H>\n"); printf("I I\n\n"); return 0; } # 阅读全文

posted @ 2021-10-28 19:25 彭涌涛 阅读(26) 评论(0) 推荐(0) 编辑

导航