Yep, I'm you're new C newbie![]()
I just started learning C (actually I already knew a lot of it, like the structure), and I've learned pretty quickly. But no one I've asked has found the bug yet. I asked the question over at Flashdaddee, but their C forum isn't very busy.Anyway, here it is. For some reason it doesn't realize it when I type 'Tman' as my username. In case it matters, I'm using djgpp as my compiler.
Can anybody find my problem?Code:#include <stdio.h> #include <string.h> int main(void) { char nick[40]; char pass[40]; int age; //Gather user's info here: printf("Welcome to a program made by Tman \n"); printf("What is your (nick)name? "); gets(nick); printf("\nHow old are you? "); scanf("%d", &age); //Now process it: if(strcmp(nick, "Tman") == 0){ printf("You're not Tman! Prove it! What's the password, then? "); gets(pass); goto check_pass; } process: printf("\n\nHello, %s.\n", nick); printf("So you're %d, eh? \n", age); printf("\nThanks for using my program!"); return 0; check_pass: if(strcmp(pass, "xYz123") == 0) { printf("\nOkay, so I was wrong. Welcome, Tman! "); } else { printf("\nHa! Caught ya! Nope, %s is not the right password.", pass); } goto process; }



LinkBack URL
About LinkBacks
Anyway, here it is. For some reason it doesn't realize it when I type 'Tman' as my username. In case it matters, I'm using djgpp as my compiler.



, but I'm just focused on making a working program. Ok, my next input call would be the one for the password (as long as 'Tman' is the nick), which comes after the printf that says 'prove it!'. But I don't see any output to the screen like that! I just don't understand..
Prelude is confused:
), so I'll keep it short and sweeet.