#include <iostream>
using namespace std;
struct Bid {
public:
Bid(int id, float price, short int pages) { // constructor
this->id = id;
this->price = price;
this->pages = pages;
}
int Get_id() { return id; } //it shows you the id of the book
float Get_price() { return price; }
short int Get_pages() { return pages; }
void Set_id(int id) { this->id = id; } //it sets the id of the book
void Set_price(float price) { this->price = price; }
void Set_pages(short int pages) { this->pages = pages; }
float Get_themostcostly(Bid book) {
return book.Get_price() > price ? book.Get_price() : price;
}
private:
int id;
float price;
short int pages;
};
int main() {
Bid B1(0, 10, 500), B2(1, 15, 1000); //B1(id of the book, price of the book, pages of the book);
cout << B1.Get_themostcostly(B2) << endl; //compares the price of the objects(in our case the books) B1 and B2
cout << B1.Get_id() << endl;
cout << B1.Get_pages() << endl;
cout << B1.Get_price() << endl;
}
Comments
Leave a comment