单位数制转换

#include<stdio.h>
#include<string.h>
void convertion1(void);
void convertion2(void);
main()
{int weight1,weight2,a;
/*char command1[]="pound to kilogram";
char command2[]="ounce to gram";
char command3[50]; */
printf("U can type in the convertion form\n"
"\"1\"means\"pounds to kilograms\"\"2\"means\"ounces to grams\"\n"
"form:");

 scanf("%d",&a);

 if(a==1)
 convertion1() ;
 else if (a==2)
 convertion2();
 else printf("wrong command!\n");


}
void convertion1(void)
{double c,a;
printf("how much pounds u want to convert:") ;
scanf("%lf",&a) ;
c=a*0.453597;
printf("%lf pounds is %lf kilograms.\n",a,c);
}
void convertion2(void)
{double  c,a;
printf("how much ounces u want to convert:") ;
scanf("%lf",&a) ;
c=a*28.349492;
printf("%lf ounces is %lf grams.\n",a,c);
}

相关信息
相关评论
相关文章
字母检索 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z