Well after a few hours with it this morning I have fixed all the bugs and answered my own questions, here is the corrected code if anyone wants to see it.
Code:
#include <stdio.h>
main()
{
int a;
printf("1.FOR loop\n2.WHILE loop\n3.DO-WHILE loop\nSelect a loop to preform:");
scanf("%d",&a);
switch(a){
case 1:
FORloop();
break;
case 2:
WHILEloop();
break;
case 3:
DOWHILEloop();
break;
default:
printf("Bad input, quitting.\n");
break;
}
getchar();
}
FORloop()
{
int b;
for(b=0;b<11;b++){
printf("%d\n",b);
}
}
WHILEloop()
{
int c=0;
while(c<11){
printf("%d\n",c);
c++;
}
}
DOWHILEloop()
{
int input,d=0;
printf("1.Good loop\n2.Bad loop\nI'll explain later ;) pick one:");
scanf("%d",&input);
if(input==1){
dwloop();
}
else if(input==2){
do{
printf("The explanation is in the source :)\n");
}while(d!=0); /*notice how it runs the "do" once even though the conditional statement is false*/
}
else{
printf("Bad input, quitting.\n");
}
}
dwloop()
{
int e=0;
do{
printf("%d\n",e);
e++;
}while(e!=11);
}