Guest User

Untitled

a guest
Jul 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include<iostream.h>
  2.  
  3. void printwarning();
  4. void printokay();
  5.  
  6. void main()
  7. {
  8. double milesremaining, fuelremaining, mpg, fuelmiles;
  9. cout<<"How many miles are you from the next gas station? ";
  10. cin>>milesremaining;
  11. cout<<"How much fuel do you have left (in gallons)? ";
  12. cin>>fuelremaining;
  13. cout<<"What is your average miles to the gallon? ";
  14. cin>>mpg;
  15. fuelmiles=fuelremaining*mpg;
  16.  
  17. if(fuelmiles<milesremaining)
  18. printwarning();
  19.  
  20. else
  21. printokay();
  22.  
  23. }
  24.  
  25. void printwarning()
  26. {
  27. cout<<"Warning: Calculations indicate that you will run out of fuel ";
  28. cout<<"before the next avaliable gas station."<<endl;
  29. }
  30.  
  31. void printokay()
  32. {
  33. cout<<"You will make it to the next gas station."<<endl;
  34. }
Add Comment
Please, Sign In to add comment