+ 1

What did I do wrong here?

#include<stdio.h> #include<string.h> void main() { char usr[20] = "admin"; char pwd[20] = "12345"; char usrIn[20], pwdIn[20]; printf("Enter username : "); gets(usrIn); printf("Enter Password : "); gets(pwdIn); if((strcmp(usr,usrIn)==0)&&(strcmp(pwd,pwdIn)==0)){ system("cls"); printf("\nyou are logged in\n"); } else { system("cls"); printf("\nusername or password is incorrect\n"); } }

4th Dec 2019, 3:53 AM
Kaisang Tamang
Kaisang Tamang - avatar
3 Réponses
+ 3
Please mention the error type you are getting or the error .
4th Dec 2019, 4:54 AM
RAJAN RAI
RAJAN RAI - avatar
+ 1
Well thanks RAJAN RAI it was not displaying the true result in sololearn, but was working good in codeblocks. I understood the mistake above was user input haha
4th Dec 2019, 6:37 AM
Kaisang Tamang
Kaisang Tamang - avatar
+ 1
printf("...OKAY BUDDY...");
4th Dec 2019, 8:42 AM
RAJAN RAI
RAJAN RAI - avatar