Car

We had to implement a code that talk about your dream car. I did the code but I got errors.

this is the header file
class car{
public:
car();
~car();
bool accelerate (int speed);
bool stop();
bool start();
bool break();
int speed;




private:
string color;
string model;
string make;
int year;
int battery;
int gas;
bool status;
};




Then this is the cpp file

#include <iostream>
#include <string>

using namespace std;

bool stop (bool st)
{
if(status==true);
{
status=false;
return true;
}
else
return false;
}

bool accelerate(int sp);
{
if (speed <(70-sp));
speed = speed sp;
return true;
}
{
else
return false;
}

bool stop (bool st)
{
if(status==true);
{
status=false;
return true;
}
else
return false;
}

bool start ();
{
if (status==false)

status==true;
return true;
{
else
cout <<"Check battery and gas" << ;
}
}
else
cout <<"The engine is already on" << ;
}
closed account (49iURXSz)
What is the scope of the program? What do you want the program to do? Without understanding what you expect the program to do, it will be very difficult for me to help out.

My best guess is that you're trying to simulate a vehicle's state. Almost like a game. http://gameprogrammingpatterns.com/game-loop.html

This is a fairly involved project to do.
Last edited on
Topic archived. No new replies allowed.