摘要: #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-23 22:10 旭日初升 阅读(121) 评论(2) 推荐(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:32 旭日初升 阅读(146) 评论(2) 推荐(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-02 22:11 旭日初升 阅读(116) 评论(2) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> const int N=4; void output(char x[], int n); // 函数声明 // 排序函数声明 void pao(char a[],int n); int main() { char stri 阅读全文
posted @ 2019-12-02 21:43 旭日初升 阅读(85) 评论(0) 推荐(0)
摘要: // 函数fun()的功能是: 找出能够被x整除并且是偶数的数, // 把这些数保存在数组bb中,并按从大到小的顺序输出。 // 例如,当x=20时,依次输出: 20 10 4 2。 #include <stdio.h> #include <stdlib.h> void fun(int k,int 阅读全文
posted @ 2019-12-02 21:38 旭日初升 阅读(368) 评论(0) 推荐(0)
摘要: //编程输出左上拐矩阵 #include<stdio.h> #include<stdlib.h> #define N 100 void fun(int x[N][N],int n) { int i,j; for(i=1;i<=n;i++) for(j=1;j<=n;j++) if(i<=j) x[i 阅读全文
posted @ 2019-12-01 22:39 旭日初升 阅读(578) 评论(0) 推荐(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:31 旭日初升 阅读(138) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<math.h> int isprime(int n); int main(){ int i; for(i=101;i<=200;i++){ if(isprime(i)) printf("%4d",i); } return 0; } int isp 阅读全文
posted @ 2019-11-18 21:47 旭日初升 阅读(91) 评论(2) 推荐(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=number; while(n 阅读全文
posted @ 2019-11-17 21:31 旭日初升 阅读(84) 评论(0) 推荐(0)
摘要: //猜数游戏 //程序运行时自动生成1——100之间的随机数,提示用户猜 //如果用户猜的数等于随机数,提示用户猜对了,程序结束 //否则,如果用户猜的数小于随机数,提示用户低了,用户继续猜 //如果用户猜的数大于随机数,提示用户高了,用户继续猜 //程序循环直到用户猜对为止 #include<st 阅读全文
posted @ 2019-11-17 21:30 旭日初升 阅读(112) 评论(0) 推荐(0)