Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <random>
- using namespace std;
- struct Book {
- int id;
- int pages;
- float price;
- };
- struct library {
- Book classics[3];
- Book horror[3];
- };
- int main() {
- setlocale(0, "");
- Book c1 = { 1, 100, 50 };
- Book c2 = { 2, 100, 50 };
- Book c3 = { 3, 100, 50 };
- Book h1 = { 4, 200, 70 };
- Book h2 = { 5, 300, 70 };
- Book h3 = { 6, 400, 70 };
- library l1 = { {c1,c2,c3},{h1,h2,h3} };
- for (int i = 0; i < 3; i++) {
- cout << "Classics literature: " << endl;
- cout << "Book: " << endl;
- cout << "ID: " << l1.classics[i].id << endl;
- cout << "Pages: " << l1.classics[i].pages << endl;
- cout << "Price: " << l1.classics[i].price << endl;
- }
- cout << "\n\n";
- for (int i = 0; i < 3; i++) {
- cout << "Horror literature: " << endl;
- cout << "Book: " << endl;
- cout << "ID: " << l1.horror[i].id << endl;
- cout << "Pages: " << l1.horror[i].pages << endl;
- cout << "Price: " << l1.horror[i].price << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment