111
、、、
/102400104 林青妍 高级语言程序设计课程第九次作业/
//14.17 10
include<stdio.h>
struct gas{
float distance;
float gals;
float mpg;
};
/*
float calculate(float distance,float gals)
{
float mpg=distance/gals;
return mpg;
}
*/
struct gas get_mpg(struct gas trip)
{
trip.mpg=trip.distance/trip.gals;
return trip;
}
//
/int main(void)
{
struct gas gas1;
printf("请输入里程数和燃料数:");
scanf("%f %f",&gas1.distance,&gas1.gals) ;
/gas1.mpg=calculate(gas1.distance,gas1.gals);/ get_mpg(gas1);
printf("distance:%f,gals:%f,mpg:%f",gas1.distance,gas1.gals,gas1.mpg);
return 0;
}/
、、、