摘要: Part2 #include <stdio.h> #include <stdlib.h> #include <string.h> const int N = 10; // 定义结构体类型struct student,并定义其别名为STU typedef struct student { long i 阅读全文
posted @ 2019-12-25 11:14 徐劲节 阅读(130) 评论(3) 推荐(0)
摘要: Part1: #include <stdio.h> #include <stdlib.h> const int N=5; // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20]; int 阅读全文
posted @ 2019-12-19 22:57 徐劲节 阅读(119) 评论(1) 推荐(0)
摘要: Part2 // 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include <stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 阅读全文
posted @ 2019-12-15 21:58 徐劲节 阅读(124) 评论(2) 推荐(0)
摘要: Part2: //寻找两个整数之间的所有素数(包括这两个整数),把结果保存在数组bb中,函数返回素数的个数。 // 例如,输入6和21,则输出为:7 11 13 17 19。 #include <stdio.h> #include <stdlib.h> #define N 1000 int fun( 阅读全文
posted @ 2019-12-01 21:52 徐劲节 阅读(186) 评论(2) 推荐(0)
摘要: Part 2 /* 编程找出5个整数的最大数和最小数 《C语言程序设计教程学习指导》p122实验内容(3) */ #include <stdio.h> #include <stdlib.h> int main() { int number, max, min, n; n=1; printf("输入第 阅读全文
posted @ 2019-11-17 21:41 徐劲节 阅读(159) 评论(2) 推荐(0)
摘要: ex2-1 ex2-2 Part2 ex2-3 ex2-4 Part3 实验结论: 本次实验由part3第一个编程实验我发现else前必须有一个精确的if,必要的时候要加{},否则程序无法运行。scanf中必须有地址符&。要注意if和switch之间的相互转换。 阅读全文
posted @ 2019-11-02 22:31 徐劲节 阅读(197) 评论(3) 推荐(0)
摘要: part1验证性内容 part2按要求写出符合要求的表达式,补全程序 判断奇偶:ex1.c 根据不同的输入,显示不同提示信息:ex2.c 根据用户输入字符,判断如果是小写字母,则转换成大写;否则保持原样:ex3.c 阅读全文
posted @ 2019-10-17 23:48 徐劲节 阅读(156) 评论(1) 推荐(1)
摘要: #include<stdio.h> int main(){ int x; printf("输入一个整数:\n"); scanf("%d",&x); if(x%2==1) printf("是奇数"); else printf("是偶数"); return 0; } /* 程序功能: 要求用户从键盘输入1~7之间的整数 如果输入的是1~5, 提示用户是工作日,要努力工作; 如果输入的是6或7,提示用户 阅读全文
posted @ 2019-10-17 23:25 徐劲节 阅读(109) 评论(0) 推荐(0)
摘要: // 功能: // 从键盘上输入单个字符 // 如果是小写字母,则转换成大写后输出 // 否则,什么也不做,原样输出 #include <stdio.h> int main() { char ch; printf("输入一个字符:\n"); scanf("%c",&ch); // 根据程序功能描述, 阅读全文
posted @ 2019-10-17 23:10 徐劲节 阅读(72) 评论(0) 推荐(0)
摘要: /* 程序功能: 要求用户从键盘输入1~7之间的整数 如果输入的是1~5, 提示用户是工作日,要努力工作; 如果输入的是6或7,提示用户是休息日,放松休息; 否则,提示用户输入不在合法范围 */ #include <stdio.h> int main() { int days; printf("输入 阅读全文
posted @ 2019-10-17 23:07 徐劲节 阅读(113) 评论(0) 推荐(0)