You are here:

C++/do while loops

Advertisement


Question
can you declare more than one condition for a while loop (such as while (hp>0 || Ehp >0);
This is a summary of my code and it keeps repeating until both are true. how do i make it do or statements. Visual studio 2003.net

Answer
Josh , Thank you for your question.

Unfortunately, you have not given enough information for me to be able to answer your question. Please resubmit your question with more details or a clearer description and I will do my best to answer.

Yes, you may use any logical (truth-valued) expression to control a do/while loop.

David Spector

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


David Spector

Expertise

Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.

Experience

I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Publications
Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

Education/Credentials
ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2016 About.com. All rights reserved.