Answer to Question #230503 in C++ for Praveen

Question #230503
You are working in a company like Uber you will be provided with number of laps the users has taken and travel details(distance, speed and direction) of laps write a program calculates the total duration of trip and also the direction in which customer has travelled
1
Expert's answer
2021-08-29T00:57:45-0400
#include <iostream>
#include <string>
using namespace std;
float time(float distance, float speed){
    return distance / speed;
}
int main(){
    int laps;
    float distance, speed;
    string direction;
    cout<<"Input number of laps: ";
    cin>>laps;
    cout<<"Input distance: ";
    cin>>distance;
    cout<<"Input speed: ";
    cin>>speed;
    cout<<"Input direction: ";
    cin>>direction;
    cout<<"\nTime: "<<time(distance, speed)<<endl;
    cout<<"Direction: "<<direction<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS