摘要: // 从文本文件file1.dat中读取数据,找出最高分和最低分学生信息,并输出在屏幕上 #include <stdio.h> #include <stdlib.h> #define N 10 // 定义一个结构体类型STU typedef struct student { int num; cha 阅读全文
posted @ 2019-12-26 21:47 Akatsuki哓 阅读(124) 评论(2) 推荐(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-21 16:24 Akatsuki哓 阅读(109) 评论(3) 推荐(0)
摘要: // 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include <stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 函数声明 i 阅读全文
posted @ 2019-12-16 22:45 Akatsuki哓 阅读(85) 评论(3) 推荐(0)
摘要: //寻找两个整数之间的所有素数(包括这两个整数),把结果保存在数组bb中,函数返回素数的个数。 // 例如,输入6和21,则输出为:7 11 13 17 19。 #include <stdio.h> #include <stdlib.h> #define N 1000 int fun(int n,i 阅读全文
posted @ 2019-12-01 22:34 Akatsuki哓 阅读(139) 评论(3) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> int main() { int number, max, min, n; n=1; printf("输入第%d个数: ", n); scanf("%d", &number); max = number; min = nu 阅读全文
posted @ 2019-11-16 11:48 Akatsuki哓 阅读(112) 评论(1) 推荐(0)
摘要: part1 ex2_1.cpp 不一致 原因:m 输出数据域宽,数据长度<m,左补空格;否则按实际输出; .n 对实数,指定小数点后位数(四舍五入),对字符串,指定实际输出位数 但浮点型数据本身有一定的误差,所以会有123.456001 ex2_2.cpp line13少了地址运算符&,line17 阅读全文
posted @ 2019-11-01 21:39 Akatsuki哓 阅读(116) 评论(4) 推荐(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-19 10:28 Akatsuki哓 阅读(123) 评论(0) 推荐(0)
摘要: #inciude<studio.h> int main () { char ch; ch=getchar(); putchar(ch); printf(''%c",ch); return o; } 阅读全文
posted @ 2019-10-01 22:34 Akatsuki哓 阅读(113) 评论(0) 推荐(0)