cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
do while loops
do while loops
Dec 26, 2014 at 2:55am UTC
mercedec
(10)
I haven't done to much with do while loops but i want this do while loop to end when either the players health = 0 or alien health = 0
do
{
} while (health = 0 | alien_health = 0);
Dec 26, 2014 at 3:14am UTC
charliep123
(3)
you want it to run while their health is not equal to zero so it should be
do{
}while(health!=0 && alien_health !=0)
this way if either health or alien health hits 0 (I assume you will not be going into the negatives) the loop will terminate
Dec 26, 2014 at 3:28am UTC
mercedec
(10)
thank you so much
Topic archived. No new replies allowed.