forked from Backslash-Computing-Society/Hacktober
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprac4.cpp
More file actions
57 lines (56 loc) · 901 Bytes
/
prac4.cpp
File metadata and controls
57 lines (56 loc) · 901 Bytes
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
#include<iostream>
//#include<cstring>
using namespace std;
class library{
int id,num,book;
string name;
void getbook()
{
book=1234;
cout<<"Book 1234 issued!";
}
public:
void get_data(int a,int b,string c)
{
id=a;
num=b;
name=c;
}
void issueb()
{
getbook();
}
void display_data()
{
if(book==1234)
{
cout<<"Username: "<<name<<endl<<"User id: "<<id<<endl<<"Number of books issued: "<<num<<endl<<"Book 1234 also issued\n";
}
else
{
cout<<"Username: "<<name<<endl<<"User id: "<<id<<endl<<"Number of books issued: "<<num<<endl;
}
}
};
int main()
{
int y,z;
char c;
string name;
library cust;
cout<<"Ennter name: ";
cin>>name;
cout<<"Ennter id: ";
cin>>y;
cout<<"Ennter no. of books: ";
cin>>z;
cust.get_data(y,z,name);
cout<<"Special book?(y/n)";
cin>>c;
if(c=='y')
{
cust.issueb();
}
cust.display_data();
return 0;
}