SHARE
TWEET

Untitled

a guest Jul 17th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "car.h"
  4. #include "plane.h"
  5. #include "train.h"
  6.  
  7. int main(void)  {
  8.     do
  9.     {
  10.     printf("Selections: 0: quit, 1: car, 2: train, 3: plane\n");
  11.     printf("Select your traveling method:\n");
  12.  
  13.     int arvo;
  14.     scanf("%d", &arvo);
  15.  
  16.     if (arvo == 0)  {
  17.         exit(0);
  18.     }
  19.     else        {
  20.    
  21.     if (arvo == 1)  {
  22.         printf("Give the distance in kilometers:\n");
  23.         double distance;
  24.         scanf("%.2lf", &distance);
  25.         printf("The time required is %.2lf minutes.", car(distance));  
  26.     }
  27.    
  28.     if (arvo == 2)  {
  29.         printf("Give the distance in kilometers:\n");
  30.         double distance;
  31.         scanf("%.2lf", &distance);
  32.         printf("The time required is %.2lf minutes.", train(distance));
  33.     }
  34.    
  35.     if (arvo == 3)  {
  36.         printf("Give the distance in kilometers:\n");
  37.         double distance;
  38.         scanf("%.2lf", &distance);
  39.         printf("The time required is %.2lf minutes.", plane(distance));
  40.     }  
  41.  }
  42.  } while (arvo != 0)
  43. return 0;
  44. }
RAW Paste Data
Top