Hi guys, I am creating a monopoly game for C++ and i am trying to use an array of spaces to display the game board but everytime i try to run it, it wont work..i realize my code is probably awful, but its what i have. any help is appreciated..

#include "Space.h"

using namespace std;

//class definition
class Game
{
      private:             //data members
         Space board[38];

      public:
         Game();
         void displayBoard();
};

Game::Game()
{
     Space s1("Go", 200, 1); // Go will be special 1
     board[0] = s1;

     Space s2("Mediterranean Ave.", 60, 0);
     board[1] = s2;

     Space s3("Community Chest", 0, 2);
     board[2] = s3;

     Space s4("Baltic Ave.", 60, 0);
     board[3] = s4;

     Space s5("Income Tax", 200, 3);
     board[4] = s5;

     Space s6("Reading Railroad", 200, 4);
     board[5] = s6;

     Space s7("Oriental Ave.", 100, 0);
     board[6] = s7;

     Space s8("Chance", 0, 5);
     board[7] = s8;

     Space s9("Vermont Ave.", 100, 0);
     board[8] = s9;

     Space s10("Connecticut Ave.", 120, 0);
     board[9] = s10;

     Space s11("Jail. Just Visiting.", 0, 6);
     board[10] = s11;

     Space s12("St. Charles Place", 140, 0);
     board[11] = s12;

     Space s13("Electric Company", 150, 7);
     board[12] = s13;

     Space s14("States Ave.", 140, 0);
     board[13] = s14;

     Space s15("Virginia Ave.", 160, 0);
     board[14] = s15;

     Space s16("Pennsylvania Railroad", 200, 8);
     board[15] = s16;

     Space s17("St. James Place", 180, 0);
     board[16] = s17;

     Space s18("Community Chest", 0, 9);
     board[17] = s18;

     Space s19("Tennessee Ave.", 180, 0);
     board[18] = s19;

     Space s20("New York Ave.", 200, 0);
     board[19] = s20;

     Space s21("Free Parking", 0, 10);
     board[20] = s21;

     Space s22("Kentucky Ave.", 220, 0);
     board[21] = s22;

     Space s23("Chance", 0, 11);
     board[22] = s23;

     Space s24("Indiana Ave.", 220, 0);
     board[23] = s24;

     Space s25("Illinois Ave.", 240, 0);
     board[24] = s25;

     Space s26("B & O Railroad", 200, 12);
     board[25] = s26;

     Space s27("Atlantic Ave.", 260, 0);
     board[26] = s27;

     Space s28("Ventnor Ave.", 260, 0);
     board[27] = s28;

     Space s29("Marvin Gardens", 280, 0);
     board[28] = s29;

     Space s30("Go To Jail", 0, 13);
     board[29] = s30;

     Space s31("Pacific Ave.", 300, 0);
     board[30] = s31;

     Space s32("North Carolina Ave.", 300, 0);
     board[31] = s32;

     Space s33("Community Chest", 0, 14);
     board[32] = s33;

     Space s34("Pennsylvania Ave.", 320, 0);
     board[33] = s34;

     Space s35("Short Line", 200, 15);
     board[34] = s35;

     Space s36("Chance", 0, 16);
     board[35] = s36;

     Space s37("Park Place", 350, 0);
     board[36] = s37;

     Space s38("Luxury Tax", 75, 17);
     board[37] = s38;

     Space s39("Boardwalk", 400, 0);
     board[38] = s39;
     }
int main()
{
    Game g;

    void displayBoard();


    system("pause");
    return 0;
}

In main() you don't need the void in front of displayBoard() like you do in the prototype up above.
Is there no definition for the displayBoard() either?
It doesn't seem like you have quite enough to be running it yet. It might compile but that's just a step in the right direction.

Also, next time please use code tags surrounding your code, it's part of the site rules and makes it easier to read.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.