Advertisement
Guest User

Rejestracja i logowanie

a guest
Jan 19th, 2017
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4. #include <ctime>
  5. #include <windows.h>
  6. #include <cstdio>
  7. #include <conio.h>
  8. using namespace std;
  9. string PIN;
  10. string proba;
  11. int proba_klucza=0;
  12. int proba_PIN;
  13. string imie_nazwisko;
  14. int main()
  15. {
  16. while(1)
  17. {
  18.  
  19. srand( time (NULL));
  20. int klucz=(rand()%1000) + 12;
  21. cout<<"Witam zarejestruj sie"<<endl;
  22. cout<<"Podaj imie i nazwisko: ";
  23. getline(cin,imie_nazwisko);
  24. cout<<"Za chwile zostanie wygenerowany klucz ktory masz przepisac ktory sprawdzi twoja autoryzacje"<<endl;
  25. Sleep(2000);
  26. cout<<"Twoj klucz to " <<klucz<<endl;
  27. cout<<"Wpisz ten klucz aby kontynowac:" ;
  28. cin>>proba_klucza;
  29. Sleep(3000);
  30. int PIN=(rand()%9999999)+1000000;
  31. if (proba_klucza==klucz)
  32. {
  33. system("cls");
  34. cout<<"Sprawdzilem klucz wszystko sie zgadza twoj PIN to "<<PIN<<endl;
  35. cout<<"Kliknij enter aby przejsc do logowania"<<endl;
  36. getchar();
  37. Sleep(2000);
  38. break;
  39. }
  40. else cout<<"Nie poprawny kod"<<endl; continue;
  41. }
  42.  
  43. do
  44. {
  45. cout<<"Witaj "<<imie_nazwisko<<" podaj swoj PIN aby sie zalogowac: ";
  46. cin>>proba;
  47. if(proba==PIN)
  48. {
  49. cout<<"Gratulacje zalogowales sie!";
  50. Sleep(2000);
  51. break;
  52. }
  53. else
  54. cout<<"Przepraszam ale PIN jest niepoprawny"<<endl;
  55. Sleep(3000);
  56. continue;
  57.  
  58. }while(PIN!=proba);
  59.  
  60. return(0);
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement