Error Fix in C++ Object Oriented Programming
I have been making this assignments for a while but can't seem to make use of 2nd option in menu to run the car. can anyone help! Code>>>>>>>>>>>>>>>>> #include <iostream> #include <string.h> using namespace std; class FuelGauge { private: int fuel; bool boolvalue; public: FuelGauge() { fuel=0; boolvalue=1; } FuelGauge(int f) { fuel=f; } void printfuel() { cout<<"The current amount of fuel in gallons is: "<<fuel<<endl; } int fuelin() { if (fuel<15) { fuel=fuel+1; cout<<"Fuel after adding 1 gallon is: "<<fuel<<endl; } else { cout<<"Error! Fuel exceeds the limit of tank capacity!!!"<<endl; } return fuel; } int fuelout() { if (fuel>0) { fuel=fuel-1; } else { cout<<"Error! Fuel tank is empty!!!"<<endl; } return fuel; } int boolreturn() { if (fuel==0) { boolvalue=0; } return boolvalue; } friend class Odometer; }; class FuelGuage; class Odometer{ private: int mileage; int count; public: Odometer() { mileage=0; count=0; } Odometer(int m) { mileage=m; } void printmileage() { cout<<"The current car's mileage is: "<<mileage<<endl; } int addmileage(FuelGauge &s) { if (mileage<999999) { mileage=mileage+1; count=count+1; if (count>24) { count=0; } cout<<"The current fuel of car is: "<<s.fuel<<" and the current mileage of car is: "<<mileage<<endl; } else if (mileage>999999) { mileage=0; } return mileage; } int decfuel(FuelGauge &s) { if (count==24) { s.fuel=s.fuel-1; } return mileage; } }; int main() { int fuel,mileage; cout<<"Enter car's fuel: "<<endl; cin>>fuel; if(fuel>15 || fuel<0) { cout<<"Error! Fuel input is invalid!!!"<<endl; exit; } cout<<"Enter car's mileage: "<<endl; cin>>mileage; if (mileage>999999 ||