• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

wchenfeng

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

2022年4月12日

编写程序将一个5×5的矩阵A存入一个二维数组,根据A生成一个新的矩阵B,存入另一个二维数组B,生成的方法是:若A的某个元素是“局部最大值”,则B的相应元素设为1;否则设为0。所谓“局部最大值”是指该值

摘要: #includeint main(){ int a[7][7]={0},i,j,b[7][7]={0}; int x,y,t; for(i=1;i=a[x][y]) t++; } } if(t==9) b[i][j]++; } ... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(105) 评论(0) 推荐(0)

编写程序实现输入五名学生数学、语文、英语的成绩,输出每门课程的平均成绩以及总分最低的学生成绩。(建立一个6行4列二维数组,最后一行存储每门课程的平均成绩,最后一列存储每名学生的总成绩)

摘要: #includeint main(){ int temp[6][4]; int i,j,sum=0; for(i=0;i<5;i++) { for(j=0;j<3;j++) { scanf(... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(434) 评论(0) 推荐(0)

编写程序实现从键盘输入一个整数,判断该数是奇数还是偶数并输出。 例如:输入13,则应输出odd。(odd奇数,even偶数)

摘要: #includeint main(){int a;scanf("%d",&a);if (a%2==0){printf("even");}else{printf("odd");}return 0;} 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(2064) 评论(0) 推荐(0)

第三章顺序结构,实现输入一个华氏温度f,要求输出摄氏温度c,公式f=9/5*c+32,要求输出结果保留到小数点后2位。

摘要: #includeint main(){ float f,c; scanf("%f",&f); c = (f - 32)*5/9; printf("%.2f",c); return 0;} 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(163) 评论(0) 推荐(0)

编写一个字符串比较函数my_strcmp,若相等输出0,否则输出两个字符串中第一个不相同字符的ASCII码差值。

摘要: #define _CRT_SECURE_NO_WARNINGS#include #include #include int my_strcmp(char a[], char b[]){ int i,x; char *p1=a,*p2=b; wh... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(249) 评论(0) 推荐(0)

将字符串类型转换成整型

摘要: #includeint main(){char a[20],*p=a;long x;scanf("%s",a);while(*p!='\0'){ x=(*p-48);p++;printf("%ld",x);}} 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(128) 评论(0) 推荐(0)

编写字符串类型输入,进行冒泡排序

摘要: #include#include#define n 5void sort(char *p[n],int k){ int i, j; char* temp;//定以以个空指针方便交换0 for (i = 0;i 0)//注意函数里面的参数的是字符串的地址 ... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(40) 评论(0) 推荐(0)

编程将10进制转换2进制(将十进制转换为二进制)

摘要: #include int main(void){ int i,j; int n; int a[32]; scanf("%d",&n); for(i=0;n>0;i++) { a[i]=n%2; n/=2; } for(j=i-1;j>=0;j... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(170) 评论(0) 推荐(0)

编写一个函数,在主函数从键盘输入三个整数,调用该函数求取这三个数的和。(将程序中的函数定义部分补充完整,不修改主函数)

摘要: #include int sum(int a,int b, int c){ int sum1; sum1=a+b+c; return sum1;}int main(void) { int a, b, c; scan... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(236) 评论(0) 推荐(0)

P214页,第8题,利用递归求斐波那契数列

摘要: 斐波那契数列:0、1、1、2、3、5、8、13、21、34 #include int Fib(int n);int main() { int n; scanf("%d",&n); printf("%d\n",Fib(n)); return ... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(35) 评论(0) 推荐(0)

下一页
 
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3