Skip to content

Instantly share code, notes, and snippets.

@marklocklear
Created March 17, 2022 12:09
Show Gist options
  • Save marklocklear/546fe5d518c4b24684ed6fe980d6164e to your computer and use it in GitHub Desktop.
Save marklocklear/546fe5d518c4b24684ed6fe980d6164e to your computer and use it in GitHub Desktop.
//Miles Per Gallon App
//Mark Locklear
#include <iostream>
using namespace std;
int main() {
string make_model;
int miles;
int gallons;
int mpg;
//get input
cout << "Model Car:";
cin >> make_model;
cout << "Miles Driven:";
cin >> miles;
cout << "Gallons used:";
cin >> gallons;
//calculate mpg
mpg = miles/gallons;
//output result
cout << "Your MPG is: " << mpg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment