Ok I was reading that Sams book about C and whatever, they were talking about the != so I used it in an 'if else' statement, then I decided to try a 'do while' statement and when I compile it it looks weird, I can't explain it, can you guys tell me why it is doing this(code wise)and also why when you execute the program why it looks like it is over lapping.
Thanks.Code:#include <stdio.h> int userNum; int x=1; int main(void) { printf("Please enter the number 1: "); scanf("%d", &userNum); { if(userNum != x) printf("Hey! I told you to type the number 1 not %d\n\n", userNum); else printf("Thank you for followind my instructions\n\n"); } do { printf("This is the do part"); } while(userNum == x); return 0; }
P.S. I know why it is repeating cause I don't have a 'variable--' thing in it but why does it look so odd when you execute it?
Also how do you make it stop by using the -- thing, I tried while(userNum ==x; x--); but it wouldn't work, can someone help, this is my first attempt at these statement things.