从键盘输入两个数字,根据订单或大或小的输出
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num1,num2;
int *num1_p=&num1,*num2_p=&num2,*pointer;
printf("Input the first number:");
scanf("%d",num1_p);
printf("Input the second number:");
scanf("%d",num2_p);
printf("num1=%d,num2=%d\n",num1,num2);
if(*num1_p>*num2_p)
{
pointer=num1_p;
num1_p=num2_p;
num2_p=pointer;
}
printf("min=%d,max=%d",*num1_p,*num2_p);
return 0;
}
#include <stdlib.h>
int main()
{
int num1,num2;
int *num1_p=&num1,*num2_p=&num2,*pointer;
printf("Input the first number:");
scanf("%d",num1_p);
printf("Input the second number:");
scanf("%d",num2_p);
printf("num1=%d,num2=%d\n",num1,num2);
if(*num1_p>*num2_p)
{
pointer=num1_p;
num1_p=num2_p;
num2_p=pointer;
}
printf("min=%d,max=%d",*num1_p,*num2_p);
return 0;
}
版权声明:本文博客原创文章,博客,未经同意,不得转载。