1813:给出车轮直径,转动圈数,花费时间,求路程和平均速度。
简单题。单位换算对即可。
There are 5280 feet in a mile.
There are 12 inches in a foot.
简单题。单位换算对即可。
There are 5280 feet in a mile.
There are 12 inches in a foot.
#include<stdio.h>
#include<iostream>
using namespace std;
#define PI 3.1415927
int main()
{
float diameter;
int revolution;
float time;
double distance;
double MPH;
for(int i=1;;i++)
{
cin>>diameter;
cin>>revolution;
cin>>time;
if(revolution==0)
break;
distance=PI*diameter*revolution/12/5280;
MPH=distance/(time/3600);
printf("Trip #%d: %.2f %.2f\n",i,distance,MPH);
}
}