-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibray.cpp
More file actions
69 lines (62 loc) · 1.31 KB
/
Libray.cpp
File metadata and controls
69 lines (62 loc) · 1.31 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
64
65
66
67
68
69
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
class Library
{
public:
int id;
char name[100];
char author[100];
char student[100];
int price;
int pages;
};
void addBook(int count)
{
Library lib[20];
cout << "Enter book id:- ";
cin >> lib[count].id;
cout << "Enter book name:- ";
cin >> lib[count].name;
cout << "Enter book author:- ";
cin >> lib[count].author;
cout << "Enter book price:- ";
cin >> lib[count].price;
cout << "Enter book pages:- ";
cin >> lib[count].pages;
count++;
};
void displayBook(int count)
{
Library lib[20];
cout << "Your total books " + count << endl;
for (int i = 0; i < count; ++i)
{
cout << "Book id - " + lib[count].id << endl;
}
}
int main()
{
int input;
while (input != 3)
{
cout << "Enter 1 to input details like id, name, author, student, price, pages" << endl;
cout << "Enter 2 to display detials" << endl;
cout << "Enter 3 to quit" << endl;
cin >> input;
int count = 0;
switch (input)
{
case 1:
addBook(count);
break;
case 2:
displayBook(count);
break;
default:
cout << "TEst";
}
};
return 0;
}