ok i am working on an elevator system and i am stuck... in the arrival method i am trying to get 400 workers to arrive within 3600 seconds... doing this
You do realise that you need two '=' signs for a comparison? The WorkerCount++; statement will never be executed the way you have it. You probably also wanted '||' instead of '&&' as well, but I'm not entirely sure what you are trying to do there...
As for spanning it out, just set the 'WorkerCount' related to the amount of seconds passed. So, you could do something like this:
apologies i generally forget about the == rule. but i did go back through my code and changed it thank you.. as for the information it is greatly appreciated. as far as
"You probably also wanted '||' instead of '&&' as well, but I'm not entirely sure what you are trying to do there..."
what would be the difference in the two operations???
'&&', or and, specifies that both conditions must be true. In your case, the statement succeeds if Seconds is 0 AND Seconds isn't 3600. If you look, though, if Seconds is 0 then it can't be 3600, can it? However, it also means that the statement will only succeed when Seconds is 0.
'||' is OR, so if either statement is true it will succeed. However, even then, you have irrelevant information...
In short, you can contract your current function to the following:
1 2 3 4 5
void Worker::Arrived() {
if (Seconds == 0)
if (WorkerCount == 0)
++WorkerCount;
}
no it is definitely not thank you for clearing that up imma have to look through my other codes and see if i have that problem elseware... thank you for your help