include iostream using namespace std struct books string name string a

 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
#include <iostream>
using namespace std;
struct books {
string name;
string author;
int year;
} book;
void insert(string name, string author, int year) {
book.name = name;
book.author = author;
book.year = year;
}
int main() {
string name, author;
int year;
printf("Enter name of the book:");
cin >> name;
printf("Enter author of the book:");
cin >> author;
printf("Enter year of the book:");
cin >> year;
insert(name, author, year);
cout << "Book name: " << book.name << endl;
cout << "Book author: " << book.author << endl;
cout << "Book year: " << book.year << endl;
return 0;
}