Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int n;
- class Book {
- int max;
- string *auth;
- string name, surname, secname;
- int yotb, books;
- public:
- void add();
- void del();
- void count();
- Book() {
- cout << "\nNumber of authors:";
- cin >> max;
- auth = new string[max];
- }
- };
- void Book::add(){
- for (int i = 0; i < max; i++) {
- cout << "\nPerson " << i + 1 << endl;
- cin.get();
- cout << "\nName:";
- getline(cin, name);
- cout << "\nSurname:";
- getline(cin, surname);
- cout << "\nSecond name:";
- getline(cin, secname);
- cout << "\nBirth year:";
- cin >> yotb;
- cout << "\nNumber of books:";
- cin >> books;
- }
- }
- void Book::del(){
- string del_surname;
- cout << "Give me a surname";
- cin.get();
- getline(cin, del_surname);
- if (del_surname == surname) {
- name = NULL;
- }
- }
- void Book::count()
- {
- cout << "Number of authors:" << max;
- }
- int main() {
- Book A, D, C;
- while (true){
- cout << "\n1.Add author\n2.Delete author\n3.Count authors\n0.Exit\n";
- int z;
- cin >> z;
- switch (z) {
- case 1: {
- cout << "\nEntering info:";
- A.add();
- break;
- }
- case 2:
- D.del();
- break;
- case 3:
- C.count();
- break;
- case 0:
- return 1;
- break;
- default:
- break;
- }
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement