会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
xc0509
博客园
首页
新随笔
联系
订阅
管理
2022年11月21日
冒泡排序法
摘要: void BubbleSort(int s[], int n) { //函数参数:数组与数组大小 int i, j, temp; for ( i = 0; i < n-1; i++) //从0开始进行n-1轮排序 { //每轮使较大的数后排 for ( j = 0; j < n-i-1; j++)
阅读全文
posted @ 2022-11-21 23:42 程碗饭
阅读(29)
评论(0)
推荐(0)
2022年11月20日
输出数组
摘要: #include <stdio.h>#include <stdlib.h> int main() { printf("使用 for 循环正向输出数组\n"); int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; int loop; for(loop = 0
阅读全文
posted @ 2022-11-20 22:28 程碗饭
阅读(178)
评论(0)
推荐(0)
2022年11月19日
利用递归求两个数的最大公约数
摘要: #include <stdio.h>int hcf(int n1, int n2);int main(){ int n1, n2; printf("输入两个正整数: "); scanf("%d %d", &n1, &n2); printf("%d 和 %d 的最大公约数为 %d", n1, n2,
阅读全文
posted @ 2022-11-19 23:04 程碗饭
阅读(411)
评论(0)
推荐(0)
2022年11月18日
求二维函数里面的值
摘要: # include<stdio.h>int main(){ int arr[5][6]={{1,2,3},{4,5,6}}; int i=0; for(i=0;i<5;i++) { int j=0; for(j=0;j<6;j++) { printf("%d",arr[i][j]); } print
阅读全文
posted @ 2022-11-18 23:05 程碗饭
阅读(26)
评论(0)
推荐(0)
2022年11月17日
用函数求四个数中的最大数
摘要: # include<stdio.h>int main() {int max4(int a,int b,int c,int d); int a,b,c,d,max; printf("Please enter 4 interger numbers:"); scanf("%d %d %d %d",&a,&
阅读全文
posted @ 2022-11-17 22:41 程碗饭
阅读(110)
评论(0)
推荐(0)
2022年11月16日
判断一个数为几位数
摘要: #include <stdio.h>#include <stdlib.h>int main(){ long long n; int count = 0; printf("输入一个整数: "); scanf("%lld", &n); //lld是long long整型// while(n != 0)
阅读全文
posted @ 2022-11-16 22:39 程碗饭
阅读(134)
评论(0)
推荐(0)
2022年11月15日
输入字符转ASCLL码
摘要: #include <stdio.h>#include <stdlib.h>int main(){ char c; printf("输入一个字符: "); scanf("%c", &c); printf("%c 的 ASCII 为 %d\n", c, c); system("pause"); retu
阅读全文
posted @ 2022-11-15 22:16 程碗饭
阅读(91)
评论(0)
推荐(0)
2022年11月14日
利用函数求一千到两千的闰年
摘要: #include <stdio.h>int is_leap_year(int y){ if(y%4==0&&y%100!=0) return 1; else return 0; }int main(){ int year=0; for(year=1000;year<=2000;year++) { i
阅读全文
posted @ 2022-11-14 21:10 程碗饭
阅读(47)
评论(0)
推荐(0)
2022年11月13日
利用函数交换两个数的值
摘要: #include <stdio.h> void swap(int* pa,int* pb) { int tmp=0; tmp=*pa; *pa=*pb; *pb=tmp; }int main(){ int a=10; int b=20; printf("a=%d,b=%d\n",a,b); swap
阅读全文
posted @ 2022-11-13 22:01 程碗饭
阅读(77)
评论(0)
推荐(0)
2022年11月12日
九九乘法表
摘要: #include <stdio.h> #include <stdlib.h> int main(){ int i = 0; int j = 0; for(i=1;i<=9;i++) { for(j=1;j<=i;j++){ printf("%dx%d=%d\t",j,i,i*j); //\t表示水平
阅读全文
posted @ 2022-11-12 21:48 程碗饭
阅读(12)
评论(0)
推荐(0)
下一页
公告