I am new to C++ so just remember that I have never programmed before and I am just looking for some pointers on finishing this program. I have a main with output that is already complete. My problem is with the class file .h and .cpp. If anyone can just tell me some of my mistakes and an idea on how to fix them I will greatly appreciate it. I am trying to grasp the concept of class files interacting with main files.This is very simple for almost everyone on here but remember I am a beginner.
Main File with output:
#include <iostream>
#include <string>
using namespace std;
#include "elevator.h"
int main()
{
elevator aLift(1);
aLift.select(5);
aLift.select(3);
return 0;
}
Output must be:
start on floor 1
going up to 2
going up to 3
going up to 4
going up to 5
open at 5
going down to 4
going down to 3
open at 3
My problem is in my class files. I am not even sure what should be an accessor and what should be a modifier.
My .h file:
#include <string>
using namespace std;
class elevator {
public:
//--constructor
elevator(int initFloor);
//--modifiers
void select(int selected_floor);
//--accessors
int aLift() const;
private:
int my_floor;
my .cpp file:
#include <iostream>
#include <string>
using namespace std;
#include "elevator.h"