上一页 1 ··· 341 342 343 344 345 346 347 348 349 ··· 407 下一页
摘要: c语言中数组,一般数组。 1、什么是数组,数组有什么用? 为了方便处理而把类型相同的变量有序地组织起来的一种形式。 类型相同的元素集中起来,在内存上排成一条直线。 2、数组的声明。 元素类型、变量名和元素个数。 如 int a[4]. 3、数组的访问。 下标运算符; 如 a[4]. 4、数组的遍历。 阅读全文
posted @ 2021-04-08 18:29 小鲨鱼2018 阅读(121) 评论(0) 推荐(0)
摘要: c语言中程序的循环控制,for语句。 1、输出从任一正整数到0的所有数字。 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); fo 阅读全文
posted @ 2021-04-07 18:45 小鲨鱼2018 阅读(623) 评论(0) 推荐(0)
摘要: c语言中程序的循环控制,while语句。 1、输出从任一正整数到0的所有数字 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); w 阅读全文
posted @ 2021-04-07 18:05 小鲨鱼2018 阅读(703) 评论(0) 推荐(0)
摘要: c语言中程序的循环控制,do语句。 1、do语句用户输入决定执行判断奇偶数程序的次数 #include <stdio.h> int main(void) { int j; do { int i; puts("please input an integer."); printf("i = "); sc 阅读全文
posted @ 2021-04-07 16:40 小鲨鱼2018 阅读(505) 评论(0) 推荐(0)
摘要: c语言中的二重循环。 1、输出九九乘法表 #include <stdio.h> int main(void) { int i, j; for (i = 1; i <= 9; i++) { for (j = 1; j <= 9; j++) { printf("%4d", i * j); } putch 阅读全文
posted @ 2021-04-06 22:07 小鲨鱼2018 阅读(1622) 评论(0) 推荐(0)
摘要: 1、c语言中分支结构程序 switch语句的经典用法。 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); switch(i % 3 阅读全文
posted @ 2021-04-06 21:07 小鲨鱼2018 阅读(828) 评论(0) 推荐(0)
摘要: 1、 非函数形式 #include <stdio.h> int main(void) { int a[4][3] = {{54,63,14},{65,85,78},{85,74,69},{25,65,78}}; int b[4][3] = {{25,65,74},{85,74,96},{25,87, 阅读全文
posted @ 2021-03-31 18:55 小鲨鱼2018 阅读(2092) 评论(0) 推荐(0)
摘要: 创建一个函数,将和有n个元素的数组中的key相等的所有元素的下标存储在另一个数组中,并返回和key元素相同的元素的个数。 1、数组元素的查找 #include <stdio.h> #define NUMBER 10 int func1(const int x[], int y[], int z, i 阅读全文
posted @ 2021-03-31 18:36 小鲨鱼2018 阅读(146) 评论(0) 推荐(0)
摘要: 创建一个函数,将和有n个元素的数组中的key相等的所有元素的下标存储在另一个数组中,并返回和key元素相同的元素的个数。 1、数组元素的查找 #include <stdio.h> #define NUMBER 10 int func1(const int x[], int y[], int z, i 阅读全文
posted @ 2021-03-31 17:26 小鲨鱼2018 阅读(107) 评论(0) 推荐(0)
摘要: c语言中数组元素的哨兵查找法,用于查找数组中是否存在特定的元素,如果存在,就返回目标元素的索引。 像对于线性查找法,哨兵查找法可以减少程序进行判断的次数。 在数组末尾追加的数据称为哨兵。 1、 #include <stdio.h> #define NUMBER 7 #define FAILED -1 阅读全文
posted @ 2021-03-31 11:29 小鲨鱼2018 阅读(1014) 评论(0) 推荐(0)
上一页 1 ··· 341 342 343 344 345 346 347 348 349 ··· 407 下一页