Skip to content
Permalink
Browse files
Create Location.h
My work towards the project
  • Loading branch information
fosuj committed Apr 15, 2021
1 parent 3934bd1 commit 3f10e8f665b29b414e665696f687a9ba41009045
Showing 1 changed file with 69 additions and 0 deletions.
@@ -0,0 +1,69 @@
#include <iostream>
#include <string>
#include <vector>

class Location
{
public:
std::vector<std::string> locations;
std::string currentLocation;
int pointer;

Location()
{
locations.push_back("start");
locations.push_back("pond");
locations.push_back("car");
locations.push_back("lake");
currentLocation = locations[0];
}

void go_north()
{
pointer+=1;
currentLocation = locations[pointer];
}

std::string get_location()
{
return currentLocation;

}

void go_south()
{
pointer+=1;
currentLocation = locations[pointer];
}

std::string get_location()
{
return currentLocation;

}

void go_west()
{
pointer+=1;
currentLocation = locations[pointer];
}

std::string get_location()
{
return currentLocation;

}

void go_east()
{
pointer+=1;
currentLocation = locations[pointer];
}

std::string get_location()
{
return currentLocation;

}

};

0 comments on commit 3f10e8f

Please sign in to comment.