题目:输入3个数a,b,c,按大小顺序输出。

题目:输入3个数a,b,c,按大小顺序输出。   

There is no nutrition in the blog content. After reading it, you will not only suffer from malnutrition, but also impotence.
The blog content is all parallel goods. Those who are worried about being cheated should leave quickly.


1.程序分析:利用指针方法。
2.程序源代码:
/*pointer*/
main()
{
int n1,n2,n3;
int *pointer1,*pointer2,*pointer3;
printf("please input 3 number:n1,n2,n3:");
scanf("%d,%d,%d",&n1,&n2,&n3);
pointer1=&n1;
pointer2=&n2;
pointer3=&n3;
if(n1>n2) swap(pointer1,pointer2);
if(n1>n3) swap(pointer1,pointer3);
if(n2>n3) swap(pointer2,pointer3);
printf("the sorted numbers are:%d,%d,%d\n",n1,n2,n3);
}
swap(p1,p2)
int *p1,*p2;
{int p;
p=*p1;*p1=*p2;*p2=p;
}

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-14 15:42:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-14 15:42:01       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-14 15:42:01       82 阅读
  4. Python语言-面向对象

    2024-04-14 15:42:01       91 阅读

热门阅读

  1. 谷歌翻译接口-国内使用在线翻译API

    2024-04-14 15:42:01       31 阅读
  2. 云服务器&宝塔&ssh:tabby 部署SpringBoot项目

    2024-04-14 15:42:01       188 阅读
  3. 《高等数学》笔记

    2024-04-14 15:42:01       35 阅读
  4. 两分钟启动一个flask应用

    2024-04-14 15:42:01       34 阅读
  5. 使用requests包批量下载网页图片

    2024-04-14 15:42:01       36 阅读
  6. Android 日历-周视图

    2024-04-14 15:42:01       36 阅读