-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLibrarysystem.cpp
More file actions
63 lines (47 loc) · 1.28 KB
/
Librarysystem.cpp
File metadata and controls
63 lines (47 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
#include <vector>
using namespace std;
class Book {
private:
string title;
string author;
int pageCount;
public:
Book(string t = "Shama chi Aai", string a = "sane guruji", int p = 450, bool format = false) {
title = t;
author = a;
pageCount = p;
}
void display() const {
cout << "Title: " << title << endl;
cout << "Author: " << author << endl;
cout << "Pages: " << pageCount << endl;
}
};
class Library {
private:
vector<Book> books;
public:
void addBook(const Book& b) {
books.push_back(b);
}
void displayAllBooks() {
for (size_t i = 0; i < books.size(); ++i) {
books[i].display();
cout << "--------------------------------------------------------------------------- " << endl;
}
}
};
int main() {
Library library;
Book book1;
library.addBook(book1);
Book book2("yayati", "V.S.Khandekar", 208, true);
library.addBook(book2);
Book book3("The Indian War of Independance", "V.D.Savarkar",474, true);
library.addBook(book3);
cout << "Library Records:" << endl;
library.displayAllBooks();
return 0;
}
hello navin