Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <conio.h>
- #include <string.h>
- using namespace std;
- int k, p, y, quantity = 4;
- bool kontynuacja()
- {
- char c;
- do
- {
- cout << "+---------------------------------+" << endl
- << "| Czy chcesz kontynuowac? |" << endl
- << "| t - nie |" << endl
- << "| n - tak |" << endl
- << "+---------------------------------+" << endl << endl;
- cout << "Wybor: ";
- c = getch();
- }
- while (c != 't' && c != 'n');
- system("cls");
- if (c == 't') return true;
- else return false;
- }
- struct users
- {
- char name[100];
- char surname[100];
- int clientNumber;
- };
- users users[1000] =
- {
- "Jan", "Kowalski", 0,
- "Anna", "Nowak", 1,
- "Adam", "Jasinski", 2,
- "Maria", "Pietraszewska", 3
- };
- void showUser(int p){
- cout << "Numer klienta: " << users[p].clientNumber<< endl;
- cout << "Imie: " << users[p].name << endl;
- cout << "Nazwisko: " << users[p].surname << endl << endl;
- };
- float addUser(){
- cout << "+---------------------------------+" << endl
- << "| Dodawanie uzytkownika |" << endl
- << "+---------------------------------+" << endl << endl;
- int a = quantity;
- cout << "Numer klienta: " << quantity << endl;
- cout << "Imie: ";
- cin >> users[a].name;
- cout << "Nazwisko: ";
- cin >> users[a].surname;
- };
- int main()
- {
- do
- {
- char x;
- cout << "+---------------------------------+" << endl
- << "| w - Wyswietl uzytkownikow |" << endl
- << "| d - Dodaj nowego uzytkownika |" << endl
- << "+---------------------------------+" << endl << endl;
- cout << " Wybor: ";
- x = getch();
- if(x == 'w'){
- system("cls");
- cout << "+---------------------------------+" << endl
- << "| p - Pojedynczy uzytkownik |" << endl
- << "| c - Cala lista uzytkownikow |" << endl
- << "+---------------------------------+" << endl << endl;
- cout << " Wybor: ";
- x = getch();
- if(x == 'p'){
- system("cls");
- cout << "+---------------------------------+" << endl
- << "| Numer uzytkownika |" << endl
- << "+---------------------------------+" << endl << endl;
- cout << " Numer: ";
- cin >> p;
- system("cls");
- showUser(p);
- }
- if(x == 'c'){
- system("cls");
- while(y <= quantity){
- showUser(y);
- y++;
- }
- y = 0;
- }
- }
- if(x == 'd'){
- system("cls");
- addUser();
- }
- }
- while (kontynuacja());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment