指针
来源:互联网 发布:nba历史各项数据排行榜 编辑:程序博客网 时间:2024/05/23 00:32
//输入的三个整数按大小顺序输出,用函数处理,
#include<stdio.h>
#include<math.h>
void swap(int *pt1,int *pt2)
{
int temp;
temp=*pt1;
*pt1=*pt2;
*pt2=temp;
}
void exchange(int *q1,int *q2,int *q3)
{if(*q1<*q2) swap(q1,q2);
if(*q1<*q3) swap(q1,q3);
if(*q2<*q3) swap(q2,q3);
}
int main()
{
int a,b,c,*p1,*p2,*p3;
printf("please enter three number:");
scanf("%d%d%d",&a,&b,&c);
p1=&a;p2=&b;p3=&c;
exchange(p1,p2,p3);
printf("the order is:%d,%d,%d\n",a,b,c);
return 0;
}
#include<stdio.h>
#include<math.h>
void swap(int *pt1,int *pt2)
{
int temp;
temp=*pt1;
*pt1=*pt2;
*pt2=temp;
}
void exchange(int *q1,int *q2,int *q3)
{if(*q1<*q2) swap(q1,q2);
if(*q1<*q3) swap(q1,q3);
if(*q2<*q3) swap(q2,q3);
}
int main()
{
int a,b,c,*p1,*p2,*p3;
printf("please enter three number:");
scanf("%d%d%d",&a,&b,&c);
p1=&a;p2=&b;p3=&c;
exchange(p1,p2,p3);
printf("the order is:%d,%d,%d\n",a,b,c);
return 0;
}
0 0
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- 指针
- FTP服务器安装
- hdu3658(矩阵快速幂)
- 我不能做到你想要的我,但我能做最好的自己
- onWindowFocusChanged和measureAllChildren
- Android的四种启动模式-----深入理解
- 指针
- json处理——Jackson框架
- setContentView和inflate区别
- 好的,坏的,真的,假的,快乐的,不快乐的
- oc将十进制转化为十六进制
- adt eclipse 中出现了大片奇怪的符号
- poj 3061 Subsequence
- DiscreteFourierTransform API 及FFT(快速傅里叶变化)总结
- 华为机试题2014 字符串过滤程序 java实现