Advertisement
Imran2544

Arbiter Login

Nov 13th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.48 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int t, x=1;
  7.     string pas, in;
  8.     scanf("%d", &t);
  9.     while (t--) {
  10.         cin>>pas>>in;
  11.         printf("Case %d: ", x++);
  12.         if (in==pas) {
  13.             printf("Login successful.\n");
  14.         }
  15.         else {
  16.             printf("Wrong password.");
  17.             string k=in, n=pas, z=pas;
  18.             int d=in.length(), l=pas.length();
  19.             for (int i=0; i<d; i++) {
  20.                 if (k[i]>=65 && k[i]<=90)
  21.                     k[i]=k[i]+32;
  22.                 else if (k[i]>=97 && k[i]<=122)
  23.                     k[i]=k[i]-32;
  24.             }
  25.             for (int i=0; i<l; i++) {
  26.                 if (n[i]>='0' && n[i]<='9')
  27.                     n.erase(n.begin()+i);
  28.             }
  29.             for (int i=0; i<l; i++) {
  30.                 if (z[i]>=65 && z[i]<=90)
  31.                     z[i]=z[i]+32;
  32.                 else if (z[i]>=97 && z[i]<=122)
  33.                     z[i]=z[i]-32;
  34.                 else if (z[i]>='0' && z[i]<='9')
  35.                     z.erase(z.begin()+i);
  36.             }
  37.             if (k==pas) {
  38.                 printf(" Please, check your caps lock key.\n");
  39.             }
  40.             else if (n==in) {
  41.                 printf(" Please, check your num lock key.\n");
  42.             }
  43.             else if (z==in) {
  44.                 printf(" Please, check your caps lock and num lock keys.\n");
  45.             }
  46.             else
  47.                 printf("\n");
  48.         }
  49.     }
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement