Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char a[20],b[20],c[20];
- int t,i,j,k,la,lb,flag=0;
- scanf("%d",&t);
- for(k=1;k<=t;k++)
- {
- flag=0;
- scanf("%s %s",a,b);
- la=strlen(a);
- lb=strlen(b);
- printf("Case %d: ",k);
- if(strcmp(a,b)==0)
- {
- printf("Login successful.\n");
- continue;
- }
- for(i=0;i<la;i++)
- {
- if(!(a[i]>='0' && a[i]<='9'))
- c[flag++]=a[i];
- }
- c[flag]='\0';
- if(strcmp(c,b)==0)
- {
- printf("Wrong password. Please, check your num lock key.\n");
- continue;
- }
- for(i=0;i<lb;i++)
- {
- if(b[i]>='a'&&b[i]<='z')
- b[i]=b[i]-32;
- else if(b[i]>='A'&&b[i]<='Z')
- b[i]=b[i]+32;
- }
- if(strcmp(b,a)==0)
- {
- printf("Wrong password. Please, check your caps lock key.\n");
- continue;
- }
- if(strcmp(b,c)==0)
- {
- printf("Wrong password. Please, check your caps lock and num lock keys.\n");
- continue;
- }
- printf("Wrong password.\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement