GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Dec-2008, 08:14
tcroat tcroat is offline
New Member
 
Join Date: Dec 2008
Posts: 2
tcroat is on a distinguished road

I need help with Linked lists and graphs


Hey there, i have an assignment due tomorrow and i'd appreciate it if someone could please explain certain things to me. I started this assignment pretty late only because i've been feeling poorly. Anyways, i'm supposed to make a graph with nodes(rooms) and link them all together where the player or user moves N, E, S or West and the first problem i have now is creating the nodes or rooms. It keeps giving me an error message in my compiler. i'm sure im doing certain things wrong. this is just the header file. Anyone offer to help please!!!

CPP / C++ / C Code:
#ifndef MAZE_H
#define MAZE_H

#include <string>

using namespace std;

class Room
{
  private: 	
    string* roomName;          // room's name    
    room* next;            // link to next room
  public: 	
    Room();                // no argument constructor
    Room(string name);
    void setNext(Room* nextRoom);
    Room* getNext();
    string* getName();
};


class RoomList
{
  private:
	Room  *start, *end;

  public:
	RoomList();
	void addFirstRoom(string name);
	void addLastRoom(string name);
	void listAllRooms();

        /*Creating New Rooms(Nodes)*/
Room*A = new Room();
Room*B = new Room();
Room*C = new Room();
Room*D = new Room();
Room*E = new Room();
Room*F = new Room();
Room*G = new Room();
Room*H = new Room();
Room*I = new Room();
Room*J = new Room();
Room*K = new Room();
Room*L = new Room();

};
#endif
Last edited by LuciWiz : 10-Dec-2008 at 08:15. Reason: Please insert your C++ code between [cpp] & [/cpp] tags
  #2  
Old 10-Dec-2008, 08:15
tcroat tcroat is offline
New Member
 
Join Date: Dec 2008
Posts: 2
tcroat is on a distinguished road

Re: I need help with Linked lists and graphs


once i can create the rooms then i can move on to setting the links!
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[CONTEST?]Data Structure Test dsmith C Programming Language 2 06-Jun-2004 16:13

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 10:46.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.