cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
needing help with converting
needing help with converting
Apr 12, 2016 at 5:49pm UTC
ashley21466
(18)
trying to convert to a do loop and a for loop
having a hard time with the do loop anyone have any suggestions?
int number = 99;
while (number > 0)
{
cout << number <<" bottles of beer on the wall.\n";
cout << number <<" bottles of beer.\n";
cout << "Take one down, pass it around.\n";
number--;
cout << number <<" bottles of beer on the wall.\n\n\n";
}
Apr 12, 2016 at 6:49pm UTC
tehHuzzlenut
(7)
All you need to do is take your code within your while loop and then move your while condition after the bottom curly bracket. Add a do at the top and your code should run perfectly.
Good luck!
Topic archived. No new replies allowed.