Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: C++ | Size: 0.47 KB | Hits: 22 | Expires: Never
Copy text to clipboard
  1. #include <iostream>
  2. using namespace std ;
  3. int main()
  4. {
  5.     float gallons = 0.0 ;
  6.       float miles = 0.0 ;
  7.       float milespergallon = 0.0 ;
  8.       cout << "How many miles did you drive?" << endl ;
  9.       cin >> miles ;
  10.       cout << "How many gallons can your car take?" << endl ;
  11.       cin >> gallons ;
  12.       milespergallon = miles/gallons ;
  13.       cout << "You drove " << milespergallon << "gallons worth" << endl ;
  14.       system ("pause");
  15.       return 0;
  16. }