Guest User

Untitled

a guest
Dec 27th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <string.h>
  5.  
  6. using namespace std;
  7.  
  8. int k, p, y, quantity = 4;
  9.  
  10. bool kontynuacja()
  11. {
  12. char c;
  13. do
  14. {
  15. cout << "+---------------------------------+" << endl
  16. << "| Czy chcesz kontynuowac? |" << endl
  17. << "| t - nie |" << endl
  18. << "| n - tak |" << endl
  19. << "+---------------------------------+" << endl << endl;
  20. cout << "Wybor: ";
  21. c = getch();
  22. }
  23. while (c != 't' && c != 'n');
  24. system("cls");
  25. if (c == 't') return true;
  26. else return false;
  27. }
  28.  
  29. struct users
  30. {
  31. char name[100];
  32. char surname[100];
  33. int clientNumber;
  34. };
  35.  
  36. users users[1000] =
  37. {
  38. "Jan", "Kowalski", 0,
  39. "Anna", "Nowak", 1,
  40. "Adam", "Jasinski", 2,
  41. "Maria", "Pietraszewska", 3
  42. };
  43.  
  44. void showUser(int p){
  45. cout << "Numer klienta: " << users[p].clientNumber<< endl;
  46. cout << "Imie: " << users[p].name << endl;
  47. cout << "Nazwisko: " << users[p].surname << endl << endl;
  48.  
  49. };
  50.  
  51. float addUser(){
  52. cout << "+---------------------------------+" << endl
  53. << "| Dodawanie uzytkownika |" << endl
  54. << "+---------------------------------+" << endl << endl;
  55.  
  56. int a = quantity;
  57.  
  58. cout << "Numer klienta: " << quantity << endl;
  59. cout << "Imie: ";
  60. cin >> users[a].name;
  61. cout << "Nazwisko: ";
  62. cin >> users[a].surname;
  63.  
  64. };
  65.  
  66. int main()
  67. {
  68.  
  69. do
  70. {
  71. char x;
  72. cout << "+---------------------------------+" << endl
  73. << "| w - Wyswietl uzytkownikow |" << endl
  74. << "| d - Dodaj nowego uzytkownika |" << endl
  75. << "+---------------------------------+" << endl << endl;
  76. cout << " Wybor: ";
  77. x = getch();
  78.  
  79. if(x == 'w'){
  80. system("cls");
  81. cout << "+---------------------------------+" << endl
  82. << "| p - Pojedynczy uzytkownik |" << endl
  83. << "| c - Cala lista uzytkownikow |" << endl
  84. << "+---------------------------------+" << endl << endl;
  85.  
  86. cout << " Wybor: ";
  87. x = getch();
  88.  
  89. if(x == 'p'){
  90. system("cls");
  91. cout << "+---------------------------------+" << endl
  92. << "| Numer uzytkownika |" << endl
  93. << "+---------------------------------+" << endl << endl;
  94.  
  95. cout << " Numer: ";
  96. cin >> p;
  97.  
  98. system("cls");
  99. showUser(p);
  100. }
  101.  
  102. if(x == 'c'){
  103. system("cls");
  104. while(y <= quantity){
  105. showUser(y);
  106. y++;
  107. }
  108. y = 0;
  109. }
  110. }
  111.  
  112. if(x == 'd'){
  113. system("cls");
  114. addUser();
  115. }
  116. }
  117.  
  118. while (kontynuacja());
  119. return 0;
  120. }
  121.  
Advertisement
Add Comment
Please, Sign In to add comment