-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbookclass.cpp
More file actions
36 lines (35 loc) · 888 Bytes
/
Copy pathbookclass.cpp
File metadata and controls
36 lines (35 loc) · 888 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
// Implement a class book with a parameterized constructor to initialize book details:
#include <iostream>
using namespace std;
class Book
{
private:
string bookName;
int price;
string authorName;
long pages;
string edition;
public:
Book(string b, int p, string a, long pg, string e)
{
bookName = b;
price = p;
authorName = a;
pages = pg;
edition = e;
}
void display()
{
cout << "Bookname: " << bookName << endl;
cout << "Price: " << price << endl;
cout << "Author Name: " << authorName << endl;
cout << "Total Pages: " << pages << endl;
cout << "Edition: " << edition << endl;
}
};
int main()
{
Book b("Object Oriented Programming with C++", 599, "E.Balaguruswamy", 1487, "second edition");
b.display();
return 0;
}