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
39
40
41
42
43
#include <iostream>
using namespace std;
struct books {
string name;
string author;
int year;
};
struct shop {
string name;
string author;
int year;
};
int main() {
struct books library_book;
struct shop shop_book;
printf("Enter name of the book:");
scanf("%s", &library_book.name);
printf("Enter author of the book:");
scanf("%s", &library_book.author);
printf("Enter year of the book:");
scanf("%i", &library_book.year);
printf("Library book:\nBook name: %s\n", library_book.name);
printf("Book author: %s\n", library_book.author);
printf("Book year: %i\n", library_book.year);
shop_book.name = library_book.name;
shop_book.author = library_book.author;
shop_book.year = library_book.year;
printf("Shop book:\nBook name: %s\n", shop_book.name);
printf("Book author: %s\n", shop_book.author);
printf("Book year: %i\n", shop_book.year);
return 0;
}