-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8.3.cpp
More file actions
24 lines (23 loc) · 766 Bytes
/
8.3.cpp
File metadata and controls
24 lines (23 loc) · 766 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
/*Write a program that declares a struture to store BookID,price and pages of a book. It defines two structures variables and input values.
It displays the record of most costly book.*/
#include<iostream>
using namespace std;
struct Info{
int bookID,price,pages;
}me1,me2;
int main(){
//Info me1,me2;
void fn(Info,Info);
fn(me1,me2);
return 0;
}
void fn(Info p, Info q){
cout<<endl<<"Enter ID,price and Pages of Book_1 :";
cin>>p.bookID>>p.price>>p.pages;
cout<<endl<<"Enter ID,Price and Pages of Book_2 :";
cin>>q.bookID>>q.price>>q.pages;
if(p.price>q.price)
cout<<"Book_1 is most costly :"<<endl<<p.bookID<<"\t"<<p.price<<"\t"<<p.pages;
else
cout<<"Book_2 is most costly :"<<endl<<q.bookID<<"\t"<<q.price<<"\t"<<q.pages;
}