| ladybug21 (1) | |
|
Please, help! i have to write a program that uses the 2 functions to repeatedly set and display the values of 2 random cards until 5 of the card pairs compare as the first is greater than the second. I understand that I have to use a while loop,but I am confused how to make that it counts until 5 first cards are greater. Does condition have to include a boolean statement? | |
|
|
|
| trynreadme (21) | |
| I'm finding it hard to understand what your program needs to do. Do you have any concept code, or can you elaborate, give an example? | |
|
|
|
| whitenite1 (705) | |
|
@ladybug21 You could use a int variable with an example name of high_card. Set it initially to 0. When you display your two cards, check if card 1 is higher than card 2. If it is, increase high_card by 1. If not, don't do anything to it. Call the functions again to display 2 more more cards, and do the check again. When high_card is equal to 5, program ends. | |
|
|
|