Really nice .gif you have there. Did you bother to look at it?
In short, look at your
Code:
do
{
if (i==6)
break;
printf(//what you are printing);
i = i + 1
}
The question is, what are you telling the program to do at the point?
In C, if you are including 2 or more lines with a if statement you need the open and close brackets surrounding the body of code. Yes C will pick up the first line, but that is it.
What I am seeing is you told your program to break out of the do/while loop when it hits 6. IF you want it to print 6, then you simply need to whisper into the ear of your program and ask nicely. The relationship between man and C is a very special one. C will do everything you tell it to do, no more no less.
A great way I've found to cycle though code that leaves no question to what belongs to what, is like
Code:
#include <stdio.h>
int main()
{
int i;
for (i=0; i<6; i++)
{
printf("WAIT FOR IT....\n");
}
if (i == 6)
{
printf("I am a C programming GOD!\n");
}
printf("I made you read a silly a message for a total of (%d) times!\n", i);
return 0;
}
AS you can see the for() and if() both contain 1 line code commands, but there is no question where that line of code belongs.
If I were to change for() to [code]{
int i;
for (i=0; i<6; i++)
printf("WAIT FOR IT....\n");
printf("Hellow World!\n");
[code] The "Hellow World!" will print out only once.