Created
July 19, 2014 00:40
-
-
Save StabbyMcDuck/8b14d11aea9ae75027e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Regina Imhoff | |
// Ecampus CS 161 | |
// Assignment #4 exercise 1 | |
#include <iostream> // includes and statements section | |
#include <string> // strings | |
#include <cctype> // c type | |
using std::cin; // user input | |
using std::cout; // machine output | |
using std::endl; // for line breaks | |
using std::string; //string | |
using std::getline; //getline | |
int milesPerGallon() { | |
int liters; | |
int miles; | |
int gallonsPerLiter = 0.264179; | |
milesPerGallon = miles * (1 / gallonsPerLiter); | |
} | |
int main() { | |
int liters; | |
int miles; | |
cout << "Let's calculate your miles per gallon!" << endl; | |
cout << "Please enter the amount of gasoline used in your last trip in liters: " << endl; | |
cin >> liters; | |
cout << "Now enter the number of miles driven during that trip: " << endl; | |
cin >> miles; | |
cout << "Your miles per gallon is: " << milesPerGallon << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment