C语言函数的问题~急等~~!写的好加分~

来源:百度知道 编辑:UC知道 时间:2024/05/05 12:40:54
编写3个函数~,用于:将英尺转变英寸~英寸转变厘米~厘米转变米~编写一个程序~通过函数调用测试这3个函数的正确性~1英尺=12英寸 1英寸=2.54厘米,100厘米=1米~
刚学的C语言~请用基本的函数来写~谢谢~了~写的好的我会加分的 ~!

main()
{
float fttoin(float);
float intocm(float);
float cmtom(float);
float a=3,b=4,c=100;
printf("%f,%f,%f",fttoin(a),intocm(b),cmtom(c));
getch();
}
float fttoin(float a)
{
return a*12;
}

float intocm(float a)
{
return a*2.54;
}

float cmtom(float a)
{
return a/100;
}

#include<stdio.h>
main( )
{
float foot,inch,centimetre,metre;
scanf("%f",&foot);
inch=12*foot;
centimetre=2.54*inch;
metre=centimetre/100;
printf("%f foot=%f inch=%f centimetre=%f metre",foot,inch,centimetre,metre);
}