Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include "car.h"
- #include "plane.h"
- #include "train.h"
- int main(void) {
- do
- {
- printf("Selections: 0: quit, 1: car, 2: train, 3: plane\n");
- printf("Select your traveling method:\n");
- int arvo;
- scanf("%d", &arvo);
- if (arvo == 0) {
- exit(0);
- }
- else {
- if (arvo == 1) {
- printf("Give the distance in kilometers:\n");
- double distance;
- scanf("%.2lf", &distance);
- printf("The time required is %.2lf minutes.", car(distance));
- }
- if (arvo == 2) {
- printf("Give the distance in kilometers:\n");
- double distance;
- scanf("%.2lf", &distance);
- printf("The time required is %.2lf minutes.", train(distance));
- }
- if (arvo == 3) {
- printf("Give the distance in kilometers:\n");
- double distance;
- scanf("%.2lf", &distance);
- printf("The time required is %.2lf minutes.", plane(distance));
- }
- }
- } while (arvo != 0)
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement