fork download
  1. //Andrew Alspaugh CSC5 Chapter 2 , P. 82, #10
  2. //
  3. /******************************************************************************
  4.  *
  5.  * Calculate MPG of a Specific Car
  6.  * ___________________________________________________________________________
  7.  * The purpose of this program is to calculate MPG of a car
  8.  *
  9.  * Formula for this program is:
  10.  * MPG = distance / /gallons
  11.  * ___________________________________________________________________________
  12.  * INPUT
  13.  * gallons :gallons
  14.  * distance :distance
  15.  *
  16.  * OUTPUT
  17.  * MPG :distance / gallons
  18.  *
  19.  *****************************************************************************/
  20. #include <iostream>
  21. using namespace std;
  22. int main()
  23. {
  24. int
  25. gallons = 12, //INPUT - gallons
  26. distance = 350, //INPUT - distance
  27. MPG = distance / gallons; //OUTPUT - distance / gallons
  28.  
  29.  
  30. cout << MPG;
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
29