-
Notifications
You must be signed in to change notification settings - Fork 81
/
Book
43 lines (43 loc) · 770 Bytes
/
Book
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
#include<stdio.h>
#include<iostream>
using namespace std;
class book {
string name,author;
float price;
public:
void getdata()
{
cout<<"Book Name: ";
cin>>name;
cout<<"\nAuthor: ";
cin>>author;
cout<<"\nPrice: ";
cin>>price;
}
friend void display(book&);
};
void display(book& a)
{
if(a.price<500||a.price>100)
{
cout<<"Book Name: "<<a.name;
cout<<"\nAuthor: "<<a.author;
cout<<"\nPrice: "<<a.price;
}
}
int main()
{
int n;
cout<<"How many entries?\n";
cin>>n;
book data[n];
for(int i=0;i<n;i++)
{
data[i].getdata();
}
for(int i=0;i<n;i++)
{
display(data[i]);
}
return 0;
}