摘要: // 从文本文件file1.dat中读取数据,找出最高分和最低分学生信息,并输出在屏幕上 #include <stdio.h> #include <stdlib.h> #define N 10 // 定义一个结构体类型STU typedef struct student { int num; cha 阅读全文
posted @ 2019-12-25 20:01 河洛元 阅读(166) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> const int N=5; // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20]; int score; 阅读全文
posted @ 2019-12-18 21:36 河洛元 阅读(106) 评论(0) 推荐(0)
摘要: // 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include <stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 函数声明 i 阅读全文
posted @ 2019-12-11 21:50 河洛元 阅读(233) 评论(4) 推荐(0)
摘要: #include <math.h> #include <stdio.h> #include <stdlib.h> // 函数声明 void solve(double a, double b, double c); // 主函数 int main() { double a, b, c; printf( 阅读全文
posted @ 2019-11-26 21:58 河洛元 阅读(213) 评论(0) 推荐(0)
摘要: // 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, r 阅读全文
posted @ 2019-11-16 17:10 河洛元 阅读(114) 评论(0) 推荐(0)
摘要: 实验心得 1.if语句要记得加{}()。 2.switch语句记得加break. 阅读全文
posted @ 2019-11-05 08:26 河洛元 阅读(147) 评论(3) 推荐(0)
摘要: #include <stdio.h> int main() { int x; printf("输入一个整数:\n"); scanf("%d",&x); if(x%2==1) printf("是奇数"); else printf("是偶数") ; return 0; } #include <stdio.h> int main(){ int days; printf("输入一个整数:\n"); sca 阅读全文
posted @ 2019-10-22 21:54 河洛元 阅读(85) 评论(0) 推荐(0)