// Example 2
// Program to accept details of books and store the details in an array.
// The program reads in details and stores them in string arrays
// The program prints details of books to the screen.
// This program only accepts details for one book.

#include <iostream>
#include <string>

const int MAX_ELEMENTS = 200;

int main()
{

    // declare a string array for each detail
    string Title[MAX_ELEMENTS];
    string Author[MAX_ELEMENTS];
    string Publisher[MAX_ELEMENTS];

    int j=0;
    cout << "Enter Book Details"<<endl;
    cout << "Enter title"<<endl;
    getline(cin,Title[j]);                 // read a detail into title array

    cout << "Enter author"<<endl;
    getline(cin,Author[j]);             // read next detail into author array

    cout << "Enter publisher"<<endl;
    getline(cin,Publisher[j]);         //read next detail into publisher array

    // output the book details
    cout<<"Title: "<<Title[j]<<endl;             // print title details
    cout<<"Author: "<<Author[j]<<endl;     // print author details
    cout<<"Publisher: "<<Publisher[j]<<endl;     // print publisher details
}