摘要: //选择法对输入的10个字符按ASCII码大小进行排序 #include <stdio.h> #define N 10 int main(){ char a[N]; char t; int i,j; printf("请输入10个字符:\n"); for(i=0;i<N;i++){ scanf("%c 阅读全文
posted @ 2020-08-18 22:44 薄眠抛却陈年事。 阅读(567) 评论(0) 推荐(0) 编辑
摘要: //冒泡法对输入的10个字符按ASCII码大小进行排序 #include <stdio.h> #define N 10 int main(){ char a[N]; char t; int i,j; printf("请输入10个字符:\n"); for(i=0;i<N;i++){ scanf("%c 阅读全文
posted @ 2020-08-18 22:42 薄眠抛却陈年事。 阅读(834) 评论(0) 推荐(0) 编辑
摘要: //打印杨辉三角形 #include <stdio.h> #define N 10 int main(){ int a[10][10]={0};//全部初始化为0; int i,j,k; for(i=0;i<10;i++){ a[i][0]=1; } for(i=1;i<10;i++){ for(j 阅读全文
posted @ 2020-08-18 22:41 薄眠抛却陈年事。 阅读(198) 评论(0) 推荐(0) 编辑
摘要: //求3*3矩阵的下三角形的和 #include <stdio.h> int main(){ int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j,sum=0; for(i=0;i<3;i++){ for(j=0;j<=i;j++){ sum+=a[i][j]; } } 阅读全文
posted @ 2020-08-18 22:39 薄眠抛却陈年事。 阅读(276) 评论(0) 推荐(0) 编辑
摘要: //两个字符串的连接 #include<stdio.h> int main(){ char str1[100],str2[100]; int i,j; printf("请输入2个字符串:\n"); gets(str1); gets(str2); for(i=0;str1[i]!='\0';i++){ 阅读全文
posted @ 2020-08-18 22:37 薄眠抛却陈年事。 阅读(394) 评论(0) 推荐(0) 编辑
摘要: //3*3矩阵转置 #include <stdio.h> void zhuanzhi(int a[][3],int n){ int i,j,t; for(i=0;i<n;i++){ for(j=i;j<n;j++){ t=a[i][j]; a[i][j]=a[j][i]; a[j][i]=t; } 阅读全文
posted @ 2020-08-18 22:36 薄眠抛却陈年事。 阅读(553) 评论(0) 推荐(0) 编辑
摘要: //1元换零钱问题 //把1元兑换成1分,2分,5分的硬币,共有多少种不同换法,请编写求解此问题的程序 #include <stdio.h> int fun(){ int i,j,k,a,count=0; for(i=0;i<=100;i++){ for(j=0;j<=50;j++){ for(k= 阅读全文
posted @ 2020-08-18 22:34 薄眠抛却陈年事。 阅读(204) 评论(0) 推荐(0) 编辑
摘要: //选择法(10个数从小到大)排序 #include<stdio.h> #define N 10 int main(){ int a[10]; int i,j,k; printf("请输入10个数:\n"); for(i=0;i<10;i++){ scanf("%d",&a[i]); } for(i 阅读全文
posted @ 2020-08-18 22:33 薄眠抛却陈年事。 阅读(1470) 评论(0) 推荐(0) 编辑
摘要: //冒泡法(10个数从小到大排序) #include <stdio.h> int main(){ int a[10]; int i,j,k; printf("请输入10个数:\n"); for(i=0;i<10;i++){ scanf("%d",&a[i]); } for(i=0;i<10;i++) 阅读全文
posted @ 2020-08-18 22:30 薄眠抛却陈年事。 阅读(2757) 评论(0) 推荐(0) 编辑
摘要: //输出以下图案 #include<stdio.h> int main(){ int i,j,k; for(i=0;i<=3;i++){ for(j=0;j<=2-i;j++){ printf(" "); } for(k=0;k<=2*i;k++){ printf("*"); } printf("\ 阅读全文
posted @ 2020-08-18 20:09 薄眠抛却陈年事。 阅读(284) 评论(0) 推荐(0) 编辑
摘要: //使用尾插法创建链表并且输出 #include<stdio.h> #include<stdlib.h> #include<malloc.h> #define LEN sizeof(struct Student) struct Student{ long long num; float score; 阅读全文
posted @ 2020-08-18 20:01 薄眠抛却陈年事。 阅读(285) 评论(0) 推荐(0) 编辑
摘要: //使用尾插法创建链表并输出 #include<stdio.h> #include<stdlib.h> #include<malloc.h> #define LEN sizeof(struct Student) struct Student{ long long num; float score; 阅读全文
posted @ 2020-08-18 19:58 薄眠抛却陈年事。 阅读(276) 评论(0) 推荐(0) 编辑