No matter what I do, I keep getting errors and I don't know what is wrong with it. I've been working on this for a day and it's just not happening. about to quit CS altogether here ;_;
//prerequisites being
//constructor that accepts year model & make arguments. constructor should //assign 0 to speed member variables.
//accessor functions to get values stored in yearModel, make, and speed
//brake should subtract 5 from speed each time it's called
//acceleration should add 5 from speed each time it's called
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
class Car
{
public:
int carmodel();
string carmake();
int carspeed();
void brake();
void accelerate();
void displayMenu();
Car(int, string, int);
private:
int yearModel;
string make;
int speed;
};
Car::Car(int year, string makeby, int sp) //sp being speed
{
yearModel = year;
make = makeby;
speed = sp;
}
//get year
int Car::carmodel()
{
return yearModel;
}
First you were trying to return a value from a void function.
this one here cout << one.accelerate() << endl;
you tried to return a value from this void function also as well as the cout symbols were the wrong direction cout << one.brake() >> endl;
I changed both of those functions from void to int.
It also looks like you started a do while loop but never completed the thought.
I removed the do and started an infinite loop using while (true){}
To exit the program I used Return 1; when somebody selected the letter C.
you have a few unused functions in the program at the moment but i'm assuming you intend to do something with them once you got the basic program working so here you go :)
You see how I added a new selection you can follow that basic idea to output make and model also.