#include <iostream>
#include <string>
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: "<<timeTaken(distanceOfOneLap, speed, NumberOfLaps)<<endl;
cout<<"Direction: "<<directionOfOneLap<<endl;
return 0;
}
Comments
Leave a comment