摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> const int N = 10; // 定义结构体类型struct student,并定义其别名为STU typedef struct student { long int id; 阅读全文
posted @ 2019-12-31 22:11 曹铮 阅读(129) 评论(1) 推荐(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-24 21:51 曹铮 阅读(111) 评论(0) 推荐(0)
摘要: // 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include <stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 函数声明 i 阅读全文
posted @ 2019-12-17 23:19 曹铮 阅读(119) 评论(1) 推荐(0)
摘要: //寻找两个整数之间的所有素数(包括这两个整数),把结果保存在数组bb中,函数返回素数的个数。 #include <stdio.h> #include <stdlib.h> #define N 1000 int fun(int n,int m,int bb[N]) { int i,j,k=0,fla 阅读全文
posted @ 2019-12-03 22:34 曹铮 阅读(123) 评论(1) 推荐(0)
摘要: 第一部分:补足程序 第二部分:输出素数 第三部分: 实验感悟 1.对isprime函数理解不到位,需要翻书。 2.函数嵌套想不出来,要花很长时间。 阅读全文
posted @ 2019-11-18 23:30 曹铮 阅读(130) 评论(1) 推荐(0)
摘要: #include<stdio.h> int main(){ int x ; printf("输入分数:"); scanf("%d",&x); if(x>0&&x<=100) switch(x/10){ case 10:printf("满分\n");break; case 9:printf("优秀\n");break; case 8:printf("良好\n");break; case 7:prin 阅读全文
posted @ 2019-11-04 22:51 曹铮 阅读(99) 评论(1) 推荐(0)
摘要: #include int main() { int x=1234; float f=123.456; double m=123.456; char ch='a'; char a[]="Hello, world!"; int y=3, z=4; printf("%d %d\n", y, z); printf("y=%... 阅读全文
posted @ 2019-11-04 22:42 曹铮 阅读(141) 评论(2) 推荐(0)
摘要: /*this is first C program*/ #include<stdio.h> int main() { printf("201983270561!") ; return 0; } #include<stdio.h> int main() { int x; printf("输入一个整数:\n") ; scanf("%d" ,&x); if(x%2==0) printf("该整数是偶数" 阅读全文
posted @ 2019-10-22 19:38 曹铮 阅读(107) 评论(0) 推荐(0)