Advertisement
Farjana_akter

Untitled

Feb 3rd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char a[20],b[20],c[20];
  6. int t,i,j,k,la,lb,flag=0;
  7. scanf("%d",&t);
  8. for(k=1;k<=t;k++)
  9. {
  10. flag=0;
  11. scanf("%s %s",a,b);
  12. la=strlen(a);
  13. lb=strlen(b);
  14. printf("Case %d: ",k);
  15. if(strcmp(a,b)==0)
  16. {
  17. printf("Login successful.\n");
  18. continue;
  19. }
  20. for(i=0;i<la;i++)
  21. {
  22. if(!(a[i]>='0' && a[i]<='9'))
  23. c[flag++]=a[i];
  24. }
  25. c[flag]='\0';
  26. if(strcmp(c,b)==0)
  27. {
  28. printf("Wrong password. Please, check your num lock key.\n");
  29. continue;
  30. }
  31. for(i=0;i<lb;i++)
  32. {
  33. if(b[i]>='a'&&b[i]<='z')
  34. b[i]=b[i]-32;
  35. else if(b[i]>='A'&&b[i]<='Z')
  36. b[i]=b[i]+32;
  37. }
  38. if(strcmp(b,a)==0)
  39. {
  40. printf("Wrong password. Please, check your caps lock key.\n");
  41. continue;
  42. }
  43. if(strcmp(b,c)==0)
  44. {
  45. printf("Wrong password. Please, check your caps lock and num lock keys.\n");
  46. continue;
  47. }
  48. printf("Wrong password.\n");
  49. }
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement