I have what I thought to be an easy function in a queue simulation.
Since it is from the textbook I expect it to work but I am getting odd output.
The Function:
int serverListType::getNumberOfBusyServers()
{
int busyServers = 0;
//int i;
cout<<"168 busy severs is "<<busyServers<<endl;
for(int i = 0; i < numOfServers; i++){
if(!servers[i].isFree()){
busyServers++;
cout<<"171 busy severs is "<<busyServers<<endl;
}
}
numBusyServer = busyServers;
return busyServers;
}
then in main
numberBusyServers = sList.getNumberOfBusyServers();
cout <<"94 main num busy servers is "<< cout <<numberBusyServers <<endl;
I expect the number outputed to the screen to be the same from the function and in main but I get :
168 busy severs is 0
94 main num busy servers is 0x6fcc92e4
96 main num busy servers is 0x6fcc92e40
the zero is within the function but I am getting a memory location in main.
I'm having a hard time testing the int in main because of this.