摘要:
#include <stdio.h> #include <stdlib.h> #include <time.h> // 遍历数组 void printArr(int array[], int length); int main(void) { /* * 需求:定义一个数组,存入1~5,要求打乱数组中 阅读全文
posted @ 2026-01-14 23:17
Zhuye_inking
阅读(9)
评论(0)
推荐(0)
摘要:
#include <stdio.h> #include <stdlib.h> #include <time.h> // 判断数组中有没有某个数 int contains(int array[], int number, int count); int main(void) { /* * 需求:生成1 阅读全文
posted @ 2026-01-14 22:30
Zhuye_inking
阅读(11)
评论(0)
推荐(0)
摘要:
#include <stdio.h> // 遍历数组中的元素并打印 void printArr(int array[], int length); int main(void) { /* * 1、数组作为函数的参数,要注意什么? * 实际上传递的是数组的首地址,如果要在函数中对数组进行遍历, * 记 阅读全文
posted @ 2026-01-14 20:43
Zhuye_inking
阅读(7)
评论(0)
推荐(0)
摘要:
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { /* * 随机数的两个弊端: * 1、种子不变,随机数结果是固定的 * 2、随机数的范围,默认范围:0~32767 * * 生成任意范围之内的随机数 * 阅读全文
posted @ 2026-01-14 15:24
Zhuye_inking
阅读(12)
评论(0)
推荐(0)
摘要:
#include <stdio.h> int main(void) { /* * 定义函数要考虑: * 1、定义函数,是为了干什么事情?——函数体 * 2、干这件事情,需要什么才能完成?——形参 * 3、我干完了,调用处是否需要继续使用?——返回值类型 * 需要继续使用,必须写 * 不需要继续使用, 阅读全文
posted @ 2026-01-14 12:55
Zhuye_inking
阅读(8)
评论(0)
推荐(0)
摘要:
#include <stdio.h> int main(void) { /* * 循环嵌套的跳出问题 * break: 只能跳出单层循环 * goto: 可以跳出多层循环,结合标号, * 可以跳转到代码中的任意地方 * 一般只用于跳出循环嵌套 * */ // 外循环 for (int i = 0; 阅读全文
posted @ 2026-01-14 10:04
Zhuye_inking
阅读(5)
评论(0)
推荐(0)
摘要:
#include <stdio.h> int main(void) { /* * 给定整数n,获取所有小于等于n的质数的数量 * 示例: * 输入:n=100 * 输出:25个质数 * */ int n; int count = 0; printf("给定一个整数:"); scanf("%d", & 阅读全文
posted @ 2026-01-14 09:07
Zhuye_inking
阅读(7)
评论(0)
推荐(0)

浙公网安备 33010602011771号