Public feed
#889828
#include <iostream>#include <fstream>#include <string>using namespace std;class FillUp { public: friend std::ostream& operator<< (std::ostream& o, const FillUp& fillup); friend std::istream& operator>> (std::ostream& o, const FillUp& fillup); float Miles,Gas,Price, Mileage; string Date; FillUp (); FillUp (float M, float G, float P, string D);};std::ostream& operator<< (std::ostream& o, const FillUp& fillup) { return o << "Date: " << fillup.Date << endl << "Miles: " << fillup.Miles << endl << "Gallons: " << fillup.Gas << endl << "Mileage: " << fillup.Mileage << endl << "Price: " << fillup.Price << endl;}FillUp::FillUp() { Miles = 0.0f; Gas = 0.0f; Price = 0.0f; Mileage = 0.0f; Date = "00/00/00";}FillUp::FillUp(float M, float G, float P, string D) { Miles = M; Gas = G; Price = P; Mileage = M/G; Date = D;}void menu (void);int main (void) { FillUp UserFill; cout << "Whats the date? (XX/XX/XX)"; cin >> UserFill.Date; cout << "Miles driven: "; cin >> UserFill.Miles; cout << "Price per gallon: "; cin >> UserFill.Price; cout << "Gallons Used: "; cin >> UserFill.Gas; UserFill.Mileage = UserFill.Miles/UserFill.Gas; system("cls"); cout << "=====Results=====" << endl; cout << UserFill; cin.ignore(); cin.get(); return 0;}