I have been working on this small program for 3 days and am able to write for loops quite easily. This time I need to convert my for loop to a do-while loop and am having quite a bit of difficulty. Using Codeblocks, here is what I have:
//For Loop
for (row = 5; row >= 1; row--)
{
for (int star = 1; star <= row; star++)
cout << "*";
cout << endl;
}
//Do While Loop
star = 0;
row = 5;
do
{
cout << "*";
cout << endl;
star++;
star = 0;
row--;
}
while ((star <= row) && (row >= 1));
My for loop works perfectly, but my do while loop only prints 1 line of 5 stars instead of what it should, which is this: (It's what my for loop prints)