I think there are a few errors with the code. Try making a flowchat of what you want to happen, because right now, you push and pop the queues, but you don't do anything with what you are popping. You are using the queue for nothing.
!armyOne.empty()
is giving you an error because armyOne isn't a queue, it's just an int, if line 31 was
while(!armyOneQueue.empty() && !armyTwoQueue.empt()
, that would repeat the loop until either army queue was empty, which in your code, would be after 1 iteration.
What I think you should do is add this after line 32:
1 2
|
armyOneSoldiers = armyOneQueue.front();
armyTwoSoldiers = armyTwoQueue.front();
|
This will allow you to push any number of int values onto the queue, representing an army's strength, then go down the queue comparing those values. As it is now, with never changing armyOneSoldiers or armyTwoSoldiers inside the loop, each if statement will always evaluate to be the same as last iteration.