Inside player() you call TRex(), and TRex() calls player(). You just have loops within loops.
TRex() shouldn't have a loop in it, which means it doesn't need a 'turn'. Also make sure to not call player.
Then you get back to the original player(), but the loop doesn't ask for a choice again, so you need to move the start of the while up a little. (to line 50).
The loop in player can be while(true), only ending via break when health is too low.
But, when the game is over, you call Entrance, which is going to make another game inside the game you are playing. Rather, simply have those conditions break the loop so that the function ends.
Then you get back to entrance, and it is done with so the program ends. You could make a loop in entrance that only continues while choice is 'Go'. Make sure to cin >> choice from within the loop, otherwise it can't update.
Something that is hiding these errors is that Player and TRex health is a global variable. Consider having the health's within player() and then pass the player's health as a reference variable to TRex.
TRex() shouldn't have a loop in it, which means it doesn't need a 'turn'. Also make sure to not call player.
Then you get back to the original player(), but the loop doesn't ask for a choice again, so you need to move the start of the while up a little. (to line 50).
The loop in player can be while(true), only ending via break when health is too low.
But, when the game is over, you call Entrance, which is going to make another game inside the game you are playing. Rather, simply have those conditions break the loop so that the function ends.
Then you get back to entrance, and it is done with so the program ends. You could make a loop in entrance that only continues while choice is 'Go'. Make sure to cin >> choice from within the loop, otherwise it can't update.
Something that is hiding these errors is that Player and TRex health is a global variable. Consider having the health's within player() and then pass the player's health as a reference variable to TRex.
![Sederhana Sederhana](/uploads/1/2/5/3/125308733/787051105.jpg)
Contoh program kondisi switch-case pada c menggunakan dev c I.PENDAHULUAN Dalam bahasa pemograman C ada 3 perulangan/looping yaitu if-else dan switch-case.Kali ini saya akan membuat program looping menggunkan switch-case dengan apikasi DEV C.