So i just startet with programming and I am trying to make a minigame. One part of the minigame is a round counter. 1 Round = 2 turns (Player 1, Player 2)
How can i write a function that gets bigger every time it is Player1's turn?
So
Round1:
-Player1
-Player2
Round2: (Game sees its Player1's turn and adds 1 to Roundnumber)
...
I tried to to it with "if or else" functions which failed and couldnt find the right "loop" for that problem.
int roundct = 0;
while(waiting for a winner or something)
{
p1.turn();
p2.turn();
roundct++; //round counter.
}
do something with roundct; //you can also use it in the loop, with a condition,
//or the while's condition even eg end if roundct > 100