#include #include #include #define SIZE 20 using namespace std; struct CD { char artist[48]; char album[48]; char reference[16]; float cost; int year; }; int main() { int option; int count = 0; bool exit = 0; char art[48]; char alb[48]; char ref[16]; float cst; int yr; char filename[100]; struct CD catalog[SIZE]; while (!exit) { cout << "The following menu options are available:\n"; cout << "Read in data [1]\n"; cout << "Print out catalogue to screen [2]\n"; cout << "Save data to file [3]\n"; cout << "Exit program [4]\n"; cout << "Enter your choice now:\n"; cin >> option; if(option == 1) { cout << "Please enter name of band/singer followed by ." << endl; cin.getline(art, 49, '.'); strcpy ( catalog[count].artist, art ); cout << "Please enter name of CD followed by ." << endl; cin.getline(alb, 48, '.'); strcpy ( catalog[count].album, alb ); cout << "Please enter reference followed by ." << endl; cin.getline(ref, 16, '.'); strcpy ( catalog[count].reference, ref ); cout << "Please enter cost:" << endl; cin >> cst; catalog[count].cost = cst; cout << "Please enter year of release:" << endl; cin >> yr; catalog[count].year = yr; count++; } if(option == 2) { for (int i=0; i> setw(100) >> filename; ofstream fout(filename); for (int i=0; i