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

wchenfeng

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

公告

上一页 1 2 3 4 5 6 7 ··· 32 下一页

2022年4月12日

根据年月日,判断已经多少天

摘要: #includeint get_days_of_month(int year, int month){//补足函数 int days,flag; //printf("Please input year:"); // ... 阅读全文

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

第四章选择结构,从键盘输入任意一个数,判断是否为素数。

摘要: #include #include int is_prime(int n){ int a,b=1,k; k=sqrt (n); for(a=2;a<=k;a++) { if(n%a==0) { b=0; break ; } } if(n==... 阅读全文

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

输入几个字符串,比较找出其中最小的字符串

摘要: #include#include#define N 20#define M 81int getstr(char p[][M]){ char t[M],n=0; printf("enter string a empty string to end\n... 阅读全文

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

(1)有一函数: 当x<1时,y=x 当1<=x<10时,y=2x-1 当x>=10时,y=3x-11 编写程序输入x,输出y的值

摘要: #includeint main(){ int x,y; scanf("%d",&x); if (x<1) y=x; else if (x<10) y=2*x-1; else y=3*x-11; printf("%d\n",y); return 0;} ... 阅读全文

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

编写程序,输入一个整数,使用逻辑表达式计算该数“大于100或小于0”的结果并输出。 例如:输入-200,则输出1

摘要: #includeint main(){ int a; scanf("%d",&a); printf("%d\n",a>100||a<0); return 0;} 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(132) 评论(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 王陈锋 阅读(2055) 评论(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 王陈锋 阅读(161) 评论(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 王陈锋 阅读(231) 评论(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 王陈锋 阅读(124) 评论(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 王陈锋 阅读(38) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 32 下一页
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3