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

wchenfeng

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

公告

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 32 下一页

2022年4月12日

编写一个程序,其有宏定义FUN(x),可用于计算x*2+x*2+x*2,实现从键盘输入一个实数a,输出FUN(a),FUN(a+1),FUN(a)*2的值。

摘要: #include#define FUN(x) x*2+x*2+x*2int main(){ int a,b,c; scanf("%d",&a); b=a+1;c=FUN(a); printf("%d\n",FUN(a)); printf("%d\n",FUN(... 阅读全文

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

输入学号,名字,年龄进行排序。(可控人数)(结构体)利用年龄进行排序。

摘要: #include #include #include #define N 5typedef struct student{ char num[10]; char name[20]; int age;}stu;void swap_student(stu *... 阅读全文

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

结构类型计算字节sizeof,人工,编译器,指针。

摘要: 编译器算出来的字节数比人工算出来的多,编译器考虑到字节对齐的原因,要求4字节对齐,读取效率加快。 人工是按1字节进行对齐。 人工的 #include#pragma pack (1)struct student{ char name... 阅读全文

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

全班 N 个学生,每个学生有学号、姓名、年龄,需要按照年龄进行排序.

摘要: #include #include #include #define N 5typedef struct student { char num[10]; char name[20]; int age;}stud;void swap_student(str... 阅读全文

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

定义一个学生结构体,用scanf读取学号、姓名、年龄信息对其赋值,之后再输出出来。

摘要: #includetypedef struct student{ char num[10],name[20]; int age;}stud;int main(int argc,char* argv[]){ int i=0; stud stu[2]; scanf(... 阅读全文

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

编字符串排列函数sort,实现从键盘输入5个字符串(每个字符串长度小于30),其ascii码从小到大排列输出,冒泡法。

摘要: #include#include#define M 5#define N 20void swap(char a[], char b[]) { char st[N]; strcpy(st, a); strcpy(a, b); strcpy(b,... 阅读全文

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

编写程序,读入3个双精度实数,求它们的平均值并按照如下个格式输出:保留4位小数,数据宽度为20、不足补0,输出正负号。

摘要: #includeint main(){ double a,b,c,sum; scanf("%lf%lf%lf",&a,&b,&c); sum=a+b+c; printf("%+020.4f\n",sum/3); return 0;} ... 阅读全文

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

c语言中i++与++i区别

摘要: #includeint main(void){ int i=5,y; y=i++*++i; printf("i=%d\n",i); printf("y=%d\n",y); i=5; y=i++*i++; printf("i=%d\n",i); printf("... 阅读全文

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

编写程序实现从键盘输入三个整数,输出三个数中的最小数。(使用if关键字)

摘要: #includeint main(){ int x,y,z,min; scanf("%d%d%d",&x,&y,&z); min=x; if (min>y) min=y; else (min=x); if(min>z) min=z; printf("... 阅读全文

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

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

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

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

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 32 下一页
 
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3