Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- #include <conio.h>
- #include <string>
- const size_t LOW_BORDER = 10;
- const size_t HIGH_BORDER = 50;
- bool add(size_t age, std::string name, std::string surname)
- {
- if (age > LOW_BORDER && age < HIGH_BORDER)
- return true;
- else
- return false;
- }
- int main()
- {
- bool isRunning = true;
- char key;
- while (isRunning)
- {
- system("cls");
- std::cout << "1) Add member" << std::endl << "2) B" << std::endl << "3) C" << std::endl << "4) Exit" << std::endl;
- if (!_kbhit())
- {
- key = _getch();
- switch (key)
- {
- case '1':
- {std::string name, surname;
- size_t age;
- system("cls");
- std::cout << "Pls enter the prarameters down below:" << std::endl << "Name = ";
- std::getline(std::cin, name);
- std::cout << "Surname = ";
- std::getline(std::cin, surname);
- std::cout << "Age = ";
- std::cin >> age;
- if (add(age, name, surname))
- std::cout << std::endl << "User is succesfully added" << std::endl;
- else
- std::cout << std::endl << "User is not added" << std::endl;
- Sleep(2000);
- }break;
- case '4':
- isRunning = false;
- break;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement