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