-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSusingGV.cpp
More file actions
48 lines (38 loc) · 857 Bytes
/
Copy pathSusingGV.cpp
File metadata and controls
48 lines (38 loc) · 857 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
37
38
39
40
41
42
43
44
45
46
47
48
#include<iostream>
using namespace std;
int n=0;
struct book{
int page;
char name[30];
};
struct book details(struct book );
void display(struct book );
struct book details(struct book b[])
{
int i;
cout<<"Enter the details of the books: "<<endl;
for(i=0;i< ::n;i++)
{ cout<<"Enter the page of "<<i+1<<" book"<<endl;
cin>>b[i].page;
cout<<"Enter the name of "<<i+1<<" book"<<endl;
cin>>b[i].name;
}
return b[n];
}
void display(struct book b[])
{ int i;
cout<<"Displaying the details of books: "<<endl;
for(i=0;i<::n;i++)
{ cout<<"Pages of book "<<i+1<<" is "<<b[i].page<<endl;
cout<<"Name of book "<<i+1<<" is "<<b[i].name<<endl;
}
}
int main()
{ int n;
struct book g[n];
cout<<"Enter the no. of books: "<<endl;
cin>>n;
::n= n;
g[n]=details(g);
display(g);
}