void main ()
{ void face ();
float u_r(float x);
float u_h(float y);
void func_2();
void func_3();
int number;
face();
printf("please input your chose:");
scanf("%d",&number);
switch(number)
{ case 1:
scanf("%f",&a);
b=u_r(a);
c=u_r(b);
printf("%fUSD=%fRMB=%fHKD,\n",a,b,c);
break;
case 2:func_2();break;
case 3:func_3();break;
default :printf("error\n");
}
}
void face()
{printf("this is a conversion software among various currency\n");
printf("1 USD TO RMB TO HKD\n");
printf("2 RMB TO USD TO HKD\n");
PRINTF("3 HKD TO USD TO RMB\n");
}
float u_r(float x)
{float x1;
x1=USDRMB*x;
return(x1);
}
float u_h(float y)
{
float x2;
x2=USDHKD*y;
return(x2);
}
void func_2()
{printf("RMB TO USD TO HKD\n");
scanf("%f",&a);
b=u_r(a);
c=u_h(b);
printf("%fRMB=%fUSD=%fHKD,\n",b,a,c);
}
void func_3()
{printf("HKD TO USD TO RMB\n");
scanf("%f",&a);
b=u_r(a);
c=u_h(b);
printf("%fHKD=%fUSD=%fRMB,\n",c,a,b);
}
老师说什么三个程序换率都一样,该怎样改?