fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. unsigned int i,t;
  5. bool b1,wl,ml,cyf,zs;
  6. string t1,log,pass;
  7. vector <string> bazal,bazap;
  8.  
  9. int main()
  10. {
  11. while (cin >> t1 >> t)
  12. {
  13. for (;t>0;t--)
  14. {
  15. b1=0,wl=0,ml=0,cyf=0,zs=0;
  16. cin >> log >> pass;
  17. if (t1=="register")
  18. {
  19. for (i=0;bazal.size()>i;i++) if (bazal[i]==log) {b1=1; break;}
  20. if (b1==1) cout << "Login zajety" << endl;
  21. else
  22. {
  23. if(log.length()>12||log.length()<3||pass.length()>15||pass.length()<5) cout << "Blad" << endl;
  24. else
  25. {
  26. for (i=0;log.length()>i;i++) if(log[i]<'0'||(log[i]>'9'&&log[i]<'A')||(log[i]>'Z'&&log[i]<'a')||log[i]>'z') {b1=1; break;}
  27. if (b1==1) cout << "Blad" << endl;
  28. else
  29. {
  30. for (i=0;pass.length()>i;i++)
  31. {
  32. if (pass[i]>64&&pass[i]<91) wl=1;
  33. else if (pass[i]>96&&pass[i]<123) ml=1;
  34. else if (pass[i]>47&&pass[i]<58) cyf=1;
  35. else zs=1;
  36. }
  37. if(wl!=1||ml!=1||cyf!=1||zs!=1) cout << "Blad" << endl;
  38. else
  39. {
  40. bazal.push_back(log);
  41. bazap.push_back(pass);
  42. cout << "Zarejestrowano" << endl;
  43. }}}}
  44. }
  45. else if (t1=="login")
  46. {
  47. for (i=0;bazal.size()>i;i++)
  48. {
  49. if (bazal[i]==log) b1=1;
  50. if (b1==1&&bazap[i]==pass) {wl=1; break;}
  51. }
  52. if (b1!=1) cout << "Konto nie istnieje" << endl;
  53. else if (wl!=1) cout << "Zle haslo" << endl;
  54. else cout << "Zalogowano" << endl;
  55. }
  56. }
  57. }
  58. return 0;
  59. }
  60.  
Success #stdin #stdout 0s 2880KB
stdin
register 3
bajtek13 Haslo123@
BITEK 123456789
bajtek13 bajteK55%
login 5
bajtek13 bajteK55%
bajtek13 Haslo123@
BITEK 123456789
bajtocjusz haselko49
bitariusz 123haSlo!@#
register 1
BITEK Dobrehaslo1!
login 1
BITEK Dobrehaslo1!
stdout
Zarejestrowano
Blad
Login zajety
Zle haslo
Zalogowano
Konto nie istnieje
Konto nie istnieje
Konto nie istnieje
Zarejestrowano
Zalogowano