📜  c++ to c 在线转换器 - BASIC 代码示例

📅  最后修改于: 2022-03-11 14:52:02.205000             🧑  作者: Mango

代码示例4
#include 
#include 
using namespace std;
float timeTaken(float dist, float sp, int totalLaps){
    return (dist /sp ) * totalLaps;
}
int main(){
    int NumberOfLaps;
    float distanceOfOneLap, speed;
    string directionOfOneLap;
    cout<<"Enter the total of laps: ";
    cin>>NumberOfLaps;
    cout<<"Enter the distance of one lap: ";
    cin>>distanceOfOneLap;
    cout<<"Enter the speed of one lap: ";
    cin>>speed;
    cout<<"Enter the direction. It must N, E, W, or S:  ";
    cin>>directionOfOneLap;
    cout<<"\nTime Taken: "<