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

wchenfeng

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

公告

2022年4月12日

11-7全局变量作用域测试

摘要: #includeint a,b;int f1(){ int a=10; printf("i am in f1 a=%d b=%d\n",a,b);}float c,d;int f2(){ float c=100.0; printf("i am in f2 a=... 阅读全文

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

extern外部函数导入使用11-8例题

摘要: file1 #includeextern float function(float a);int main(){ printf("reseult=%f\n",function(3.0));} file 2 float function(float a){ re... 阅读全文

posted @ 2022-04-12 20:04 王陈锋 阅读(37) 评论(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 王陈锋 阅读(2045) 评论(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 王陈锋 阅读(159) 评论(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 王陈锋 阅读(229) 评论(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 王陈锋 阅读(37) 评论(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 王陈锋 阅读(160) 评论(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 王陈锋 阅读(225) 评论(0) 推荐(0)

自己编写一个strcpy函数,补充到以下代码框架中,实现字符串的复制。 字符串长度不超过32

摘要: #include #include void my_strcpy(char dst[], char src[]){ int i=0; for(; dst[i]!='\0';i++) dst[i]=src[i]; dst[i]='\0';}void mai... 阅读全文

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

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