#include #include // Programmer: Dan Bennett // Program 0: Grandmother's Trunk // // This program will simulate a game of Grandmothers Trunk. // CSCI 130, Fall 2022 // // This program was developed in class with the collaboration of everyone there // // this is an example program developed outside of class // Class examples may differ from this example. using namespace std; const string COMPUTER_ITEM_1 { "bottle of wine"}; const string COMPUTER_ITEM_2 { "photo album"}; int main() { string owner; string container; string item1, item2, item3; // get the owner cout << "Please enter a person (as a single word) => "; cin >> owner; cin.ignore(100, '\n'); // get the container cout << "Please enter a container (as a single word) that " << owner << " owns => "; cin >> container; cin.ignore(100,'\n'); cout << "Very well, we will look at items in your " << owner << "'s " << container << "." << endl; cout << endl; // get the items from the user cout << "Please enter an item you found in your " << owner << "'s " << container << " => "; getline(cin, item1); cout << "You gave me a " << item1 << "." << endl; cout << endl; cout << "Please enter another item you found in your " << owner << "'s " << container << " => "; getline(cin, item2); cout << "You gave me a " << item2 << "." << endl; cout << endl; cout << "Please enter a final item you found in your " << owner << "'s " << container << " => "; getline(cin, item3); cout << "You gave me a " << item3 << "." << endl; // tell what the computer selected cout << endl; cout << "I selected a " << COMPUTER_ITEM_1 << " and a " << COMPUTER_ITEM_2 << "."; cout << endl; // play the game cout << "So the game will be:" << endl; cout << endl; cout << "In my " << owner << "'s " << container << " I found" << endl; cout << "a " << item1 << "." << endl; cout << endl; cout << "In my " << owner << "'s " << container << " I found" << endl; cout << "\ta " << item1 << "," << endl; cout << "\tand a " << COMPUTER_ITEM_1 << "." << endl; cout << endl; cout << "In my " << owner << "'s " << container << " I found" << endl; cout << "\ta " << item1 << "," << endl; cout << "\tand a " << COMPUTER_ITEM_1 << "," << endl; cout << "\tand a " << item2 << "." << endl; cout << endl; cout << "In my " << owner << "'s " << container << " I found" << endl; cout << "\ta " << item1 << "," << endl; cout << "\tand a " << COMPUTER_ITEM_1 << "," << endl; cout << "\tand a " << item2 << "," << endl; cout << "\tand a " << COMPUTER_ITEM_2 << "." << endl; cout << endl; cout << "In my " << owner << "'s " << container << " I found" << endl; cout << "\ta " << item1 << "," << endl; cout << "\tand a " << COMPUTER_ITEM_1 << "," << endl; cout << "\tand a " << item2 << "," << endl; cout << "\tand a " << COMPUTER_ITEM_2 << "," << endl; cout << "\tand a " << item2 << "." << endl; cout << endl; return 0; }