23Zone
Hey, I'm new here and new to C++ and I've been learning it pretty quickly. Today my teacher gave the class a problem to do involving loops. It was, for me, pretty simple because we had just went over it. I completed the problem, well that is what I thought. He told me now I had to insert the functions or prototypes or whatever for while, do while, and for loop. I didn't have time to stay in class so I told him I was going to turn it in tomorrow. I am seriously lost.
Here's, according to him, half the problem. We basically had to countdown from 5,4,3,2,1 followed by Blast off on each statement.
#include <stdio.h>
int main(void)
{
// Local Declarations
int loopcount;
// Statements
loopcount = 5;
printf("while loop :");
while (loopcount > 0)
printf("%3d", loopcount--);
printf("\t\tBlast Off!!!\n\n");
loopcount = 5;
printf("do...while loop: ");
do
printf("%3d", loopcount--);
while (loopcount > 0);
printf("\tBlast Off!!!\n\n");
printf("for loop: ");
for(loopcount=5;loopcount > 0;loopcount--)
{
printf("%3d", loopcount);
}
printf("\t\tBlast Off!!!\n\n");
return 0;
} // main
If you have any comment on my situation, I would appreciate your comments.
Thank You,
23Zone