Advertisement
erfanul007

LA 5047

Dec 1st, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<string>
  3. using namespace std;
  4. int main()
  5. {
  6. string str1,str2,str3,str4,str5;
  7. int n;
  8. freopen("input.txt","r",stdin);
  9. cin>>n;
  10. for(int i=1;i<=n;i++){
  11. cin>>str1>>str2;
  12. cout<<"Case "<<i<<": ";
  13. if(str1==str2)
  14. cout<<"Login successful."<<endl;
  15.  
  16. else{
  17. cout<<"Wrong password.";
  18. str3=str1;
  19. str4=str1;
  20. str5=str1;
  21. int j=0;
  22. while(j<str1.size()){
  23. if(str5[j]>='a' && str5[j]<='z')
  24. str5[j]=(str5[j]-'a')+'A';
  25.  
  26. else if(str5[j]>='A' && str5[j]<='Z')
  27. str5[j]=(str5[j]-'A')+'a';
  28.  
  29. j++;
  30. }
  31. j=0;
  32. while(j<str3.size()){
  33. if(str3[j]>='0' && str3[j]<='9'){
  34. str3.erase(str3.begin()+j);
  35. str4.erase(str4.begin()+j);
  36. }
  37. else{
  38. if(str4[j]>='a' && str4[j]<='z')
  39. str4[j]=(str4[j]-'a')+'A';
  40.  
  41. else if(str4[j]>='A' && str4[j]<='Z')
  42. str4[j]=(str4[j]-'A')+'a';
  43.  
  44. j++;
  45. }
  46. }
  47. if(str5==str2)
  48. cout<<" Please, check your caps lock key.";
  49. else if(str3==str2)
  50. cout<<" Please, check your num lock key.";
  51. else if(str4==str2)
  52. cout<<" Please, check your caps lock and num lock keys.";
  53.  
  54. cout<<endl;
  55. }
  56. }
  57. return 0;
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement