#include
#include
int main()
{
double x, y;
double temp; /段兆/这个变量用来临时存放需要交换的值
printf("please input x: ");
scanf("%lf", &x);
printf("please input x: ");
scanf("%lf", &y);
printf("脊和yue are x and y: %f, %f\握野租n", x, y);
//开始交换数据的三行代码
temp = x;
x = y;
y = temp;
//**************
printf("swaped x and y: %f, %f\n", x, y);
getchar();
//getchar();
return(0);
}
#include
int main()
{
double x, y;
double temp;
printf("input two Numbers: ");
scanf("%lf %lf", &x, &y);
printf("世圆型腔旁%lf, %lf\n", x, y);
temp = x;
x = y;
y = temp;
printf("%lf, %lf\n"搜猜, x, y);
饿.....
void main()
{
float x,y,z;
scanf("%f%f",&x,&y);
printf("\n交换前x=%f,y=%f\n",x,y);
/笑老圆/含灶交换
z=x;
x=y;
y=z;//这样就交换了
printf("\n交换后碰塌x=%f,y=%f\n",x,y);
}
#include<铅州srdio.h>
viod main()
{
double x,y,a;
scanf("巧伍%lf %lf",&x,&y);
a=x;
x=y;
y=a;
printf("%lf, %lf\孝激或n", x, y);
}
#include
void swap(double &x, double &y)
{
double temp = 0.0;
temp = y;
y = x;
x = temp;
}
void main()
{
double x = 0.0,y = 0.0;
scanf("%lf %lf"唤键,&x,&y);
printf("%lf\t%lf\n"带念,x,y);
swap(x,y);
printf("和行巧%lf\t%lf\n",x,y);
}