#include using namespace std; struct book { string ISBN; int QOH; float price; }; // A struct used to hold a name struct name { string lastName; string firstName; }; // A struct that contains another struct and an array struct student { string CLID; name studentName; int scores[3]; } newStu; const int MAX = 2; void loadBooks(book bookList[]); void findaBook(book bookList[]); void howManyAreThere(book bookList[]); int main() { // book struct demonstration // book bookList[MAX]; // Make an array of book structs loadBooks(bookList); // Load data into it findaBook(bookList); // Print out a book howManyAreThere(bookList); // Add up the QOHs // student struct demonatration cout << "Input CLID: "; cin >> newStu.CLID; cout << "Input last name: "; cin >> newStu.studentName.lastName; cout << "Input first name: "; cin >> newStu.studentName.firstName; for(int i = 0; i < 3; i++) { cout << "Input score " << i+1 << ": "; cin >> newStu.scores[i]; } float avg; avg = (newStu.scores[0] + newStu.scores[1] + newStu.scores[2]) / 3.0; cout << newStu.studentName.firstName << "'s average is: " << avg << endl; return 0; } void loadBooks(book bookList[]) { for(int i = 0; i < MAX; i++) { cout << "Enter an ISBN, QOH, and price "; cin >> bookList[i].ISBN >> bookList[i].QOH >> bookList[i].price; } } void findaBook(book bookList[]) { int bookNum; cout << "Enter a book number (1 thru " << MAX << "):"; cin >> bookNum; bookNum--; cout << bookList[bookNum].ISBN << " " << bookList[bookNum].QOH << " " << bookList[bookNum].price << endl; } void howManyAreThere(book bookList[]) { int total = 0; for(int j = 0; j < MAX; j++) total += bookList[j].QOH; cout << "There are a total of " << total << " books in the list." << endl; }