I have a function that reads in requests: by timestamp, current floor, and destination floor and it is not outputting the way I expected.
All my member values are outputting correctly : timestamp, current floor, and destination floor except for the bool.
The bool outputs 205 instead 1 or 0 for my direction.
Elevator::readRequests() { ifstream myStream("T1.txt"); while(!myStream.eof()) { int timestamp ,currentFloor, destinationFloor; myStream >> timestamp >> currentFloor >> destinationFloor; //cout<< endl <<"The current timestamp is "<< timestamp << "The current floor is " << currentFloor // << " and the destination floor is " << destinationFloor << endl << endl; //cout<< endl; reqNode *temp = new reqNode; //initialize request node object temp->timestamp = timestamp; temp->start = currentFloor; temp->destination = destinationFloor; temp->start_time = -1; temp->finish_time = -1; temp->calculate_priority(); if(temp->start < temp->destination) temp->set_dir(true); else temp->set_dir(false); request.push(*temp);//push nodes into the request bank } int i = 0; while( !request.empty() ) { cout << "Node " << i << " : " << request.front().timestamp << " " << request.front().start << " " << request.front().destination << " " << request.front().direction << endl; request.pop();//popping the request in order to test i++; } } I am trying to get the output:
Node # : Timestamp. Current(User Floor). Destination(User Floor). Direction(User is heading).
Node 0 : 1 3 7 1 Node 1 : 1 2 9 1 Node 2 : 1 7 9 1 Node 3 : 2 4 6 1 Node 4 : 2 4 8 1 Node 5 : 2 1 17 1 Node 6 : 5 1 15 1 Node 7 : 5 5 1 0 Node 8 : 6 17 4 0 Node 9 : 6 4 17 1 Instead I am getting as output:
Node 0 : 1 3 7 205 Node 1 : 1 2 9 205 Node 2 : 1 7 9 205 Node 3 : 2 4 6 205 Node 4 : 2 4 8 205 Node 5 : 2 1 17 205 Node 6 : 5 1 15 205 Node 7 : 5 5 1 205 Node 8 : 6 17 4 205 Node 9 : 6 4 17 205 this is the file T1.txt:
1 3 7 1 2 9 1 7 9 2 4 6 2 4 8 2 1 17 5 1 15 5 5 1 6 17 4 6 4 17
reqNode.boolin there anywhere..