-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbooks.cpp
More file actions
80 lines (71 loc) · 2.35 KB
/
Copy pathbooks.cpp
File metadata and controls
80 lines (71 loc) · 2.35 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
70
71
72
73
74
75
76
77
78
79
80
#include<iostream>
using namespace std;
class books
{
public:
string title;
int copies_available = 5;
string a,b;
string author;
string publisher;
int c,d,e,f;
int price = 750;
int stock_position = 120;
books(){}
//constructor for the book class
books(string title , string author , string publisher , int price)
{
title = "harrypotter";
author = "jkrowling";
publisher = "Puffin";
price = 750;
}
void input()
{
cout<<"Enter the book title and author "<<endl;
cin>>a;
cout<<endl;
cin>>b;
}
void output()
{
if(a==title)
{
cout<<"Enter the author name"<<endl;
cin>>b;
if(b==author)
{
cout<<"YAY !! THE BOOK IS IN THE STOCK"<<endl;
cout<<"How many copies do you want ?"<<endl;
cin>>c;
if(c==copies_available)
{
cout<<"YAY ! YOUR ORDER HAS BEEN PLACED SUCCESSFULLY"<<endl<<endl;
cout<<"-------------------------------------";
cout<<"-----------ORDER SUMMARY-------------";
cout<<"-------------------------------------"<<endl;
cout<<" Book title - "<<title;
cout<<" Book author -"<<author;
cout<<" Book price - "<<price;
cout<<" Number of copies - "<<c<<endl;
cout<<"--------------------------------------";
}
else
{
cout<<"Aww ! Sorry we dont have that kind of stock right now "<<endl;
cout<<"Please come some time later "<<endl;
}
}else
{
cout<<"Sorry ! we dont have the specified book right now "<<endl;
cout<<"Please come some time else"<<endl;
}
}
};
int main()
{
books B;
B.input();
B.output();
return 0;
}