Assignment Program Crashing

I have an assignment for my university programming course which reads meetings from a file and assigns them to rooms using a given algorithm. The meetings in the file are in the format: ID Start Finish. For example,

M1 1 4

The algorithm is as follows:

BEGIN

Create a room

While there exists a meeting that has not been assigned to a room
select a meeting with the smallest start time

if there is a room with no meetings that clash with the selected meeting then
assign the selected meeting to that room
else
create a new room
assign the selected meeting to the new room

End-While

END

Requirements are to define an appropriate Meeting class and Room class and schedule meetings to rooms using the above algorithm which will result in the fewest rooms being used.

This was my attempt at coding this algorithm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 Room qRoom[obARRAY_SIZE];

	//use first room 
	//qRoom[uiIdex];	
	uiRoomCounter = 1;		//one room available

	qRoom[uiIdex].setRoomID( uiRoomCounter );		//Room 1
	qRoom[uiIdex].setMeetings( qMeeting[uiIdex] );		//assign first meeting to Room 1
	
	//while loop assigns all meetings to minimum number of rooms
	//previous sorting ensures next meeting always has smallest start time

/*while ( uiIdex < uiMeetCounter )
		{ 
		//for loop checks for clashes in available rooms
		for ( unsigned int uiI=0; uiI < uiRoomCounter; uiI++ )	//cycle thru rooms
		{
			uiMeetingNum = qRoom[uiI].getMeetingNum();

			for ( unsigned int uiJ=0; uiJ < uiMeetingNum; uiJ++ )		//cycle thru meetings
			{
				//if there is a clash
				if    ( (qMeeting[uiI+1].getStartTime()) >= ((qRoom[uiI].getMeetings( uiJ )).getStartTime()) 
					&&( (qMeeting[uiI+1].getStartTime()) <= ((qRoom[uiI].getMeetings( uiJ )).getFinishTime()) ) )
				{
					RoomCounter++;		//increment the number of available rooms
					qRoom[uiI+1].setMeetings( qMeeting[uiI+1] );	//assign the meeting to next room in Room array
					qRoom[uiI+1].setRoomID( uiRoomCounter );		//set the room number
				
				}

				//assign meeting to same room if no clash 
				else
				{
					qRoom[uiI].setMeetings( qMeeting[uiI+1] );
					qRoom[uiI].setRoomID( uiRoomCounter );
				}
			}
		}//end clash check
		
		uiIdex++;

	}//end meeting scheduling*/ 

Topic archived. No new replies allowed.