You are on page 1of 1

EXP3_2 #include<iostream.h> #include<conio.

h> class book { public: char name[10]; float price; int pages; void accept() { cout<<"Book Title:\t"; cin>>name; cout<<"\nBook Price:\t"; cin>>price; cout<<"\nBook Pages:\t"; cin>>pages; } void display() { cout<<"\nBook Title:\t"<<name; cout<<"\nBook Price:\t"<<price; cout<<"\nBook Pages:\t"<<pages; } }; void main() { int i=0; clrscr(); cout<<"\t\t\t\tBOOK DETAILS"; book b[2],temp; for(i=0;i<2;i++) { cout<<"\n\n"; b[i].accept(); } if(b[0].price>b[1].price) { b[0].display(); } else { b[1].display(); }

getch(); }

Page 1

Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)