Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.62 KB | None | 0 0
  1. #include <iostream>
  2. #include "Wektory.h"
  3. #include "Uzytkownik.h"
  4. int main() {
  5. typedef string DATA;
  6. DATA login;
  7. DATA name;
  8. DATA surname;
  9.  
  10. Wektory *a = new Wektory();
  11. Uzytkownik *b =new Uzytkownik("klocuch","xD","Dx");
  12. a->user.push_back(b);
  13.  
  14. int choose=1;
  15. while(choose!=0)
  16. {
  17. cout << "============" << endl;
  18. cout << "MENU GLOWNE:" << endl;
  19. cout << "============" << endl;
  20. cout << "\n[0]Wyjscie.\n[1]Dodaj uzytkownika.\n[2]Edytuj uzytkownika.\n[3]Usun uzytkownika.\n[4]Wyswietl uzytkownikow." << endl;
  21. cout << "\nPodaj wybor: ";
  22. cin >> choose;
  23.  
  24. if(choose) {
  25. switch (choose) {
  26. default:
  27. break;
  28. case 1:
  29. cout<<"Podaj pozadany login: ";
  30. cin>>login;
  31. for(vector<Uzytkownik*>::iterator it1 = a->user.begin(); it1 != a->user.end(); it1++)
  32. {
  33. if((*it1)->login == login)
  34. {
  35. cout<<"Login jest zajety!!!"<<endl;
  36. break;
  37. }
  38. else
  39. {
  40. cout<<"Podaj imie: ";
  41. cin>>name;
  42. cout<<"Podaj nazwisko: ";
  43. cin>>surname;
  44. Uzytkownik *b = new Uzytkownik(login, name, surname);
  45. a->user.push_back(b);
  46. cout<<"Dodawanie zakonczone sukcesem!"<<endl;
  47. break;
  48. }
  49. }
  50. break;
  51. case 2:
  52. cout<<"Podaj login uzytkownika, ktorego chcesz edytowac: ";
  53. cin>>login;
  54. for(vector<Uzytkownik*>::iterator it1 = a->user.begin(); it1 != a->user.end(); it1++)
  55. {
  56. if((*it1)->login == login)
  57. {
  58. for (;;)
  59. {
  60. cout<<"======================"<<endl;
  61. cout<<"EDYTOWANIE UZYTKOWNIKA:"<<endl;
  62. cout<<"======================\n\n"<<endl;
  63. int pick=0;
  64. cout<<"MENU:\n[0}Wyjscie z edycji.\n[1]Zmiana loginu.\n[2]Zmiana imienia.\n[3]Zmiana nazwiska.\n\n"<<endl;
  65. cin>>pick;
  66. if(pick!=0) {
  67. switch (pick) {
  68. case 1:
  69. cout << "ZMIANA LOGINU.\nPodaj nowy login: " << endl;
  70. cin>>login;
  71. (*it1)->login=login;
  72. break;
  73. case 2:
  74. cout << "ZMIANA IMIENIA\nPodaj nowe imie: " << endl;
  75. cin>>name;
  76. (*it1)->name=name;
  77. break;
  78. case 3:
  79. cout << "ZMIANA NAZWISKA.\nPodaj nowe nazwisko: " << endl;
  80. cin>>surname;
  81. (*it1)->surname=surname;
  82. break;
  83. default:
  84. if (pick == 0)
  85. break;
  86. }
  87. }else
  88. {
  89. break;
  90. }
  91. }
  92.  
  93. }
  94.  
  95. }
  96. break;
  97. case 3:
  98. for(vector<Uzytkownik*>::iterator it1 = a->user.begin(); it1 != a->user.end(); it1++)
  99. {
  100.  
  101. }
  102. break;
  103. case 4:
  104. for(vector<Uzytkownik*>::iterator it1 = a->user.begin(); it1 != a->user.end(); it1++)
  105. {
  106. (*it1)->print();
  107. }
  108. break;
  109. case 0:
  110. return 0;
  111. }
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement