-5

Trying to get the welcome output after using 'abcd' as username and '1234' as password.

int main()

{

char username[5];
int password;

printf("username: \t");
scanf("%s", username); 

printf("password: \t");
scanf(" %d", &password);

(( username=='abcd')&&(password==1234)?printf("\nwelcome"):printf("\nlogin failed")); 

}
ayush002
  • 9
  • 1

1 Answers1

0

Use strcmp(username, "abcd") == 0 instead of username=='abcd'

Weather Vane
  • 33,872
  • 7
  • 36
  • 56
galfisher
  • 1,122
  • 1
  • 13
  • 24