The code provided has several areas that could be improved, such as using a while loop instead of a while(1) or while(true) loop, avoiding the excessive use of print/cout/cin/ file stream/stringstream and/or endl and/or << >>, improving the variable names, returning 0 for success instead of failure, and avoiding the use of continue, break, and goto in loops and if statements. Additionally, the code could benefit from handling erroneous input in the default case of the switch statement, avoiding unnecessary abrupt program termination, and ensuring that the test runs match the program output. Lastly, it is recommended to leave a couple of blank lines before and after the menu, left-align text entries, right-align numeric entries with the same number of decimal places, and fix invalid stats where the input file has fewer entries than the program claims to have read. CODING #include <iostream> #include <fstream> #include <string> #include <limits> using namespace std; const int MAX_SIZE = 100; void printMenu() { cout << "Menu\n\n"; cout << "1: Print the array\n"; cout << "2: Print the stats\n"; cout << "3: Exit the program\n"; } void printArray(string arr[], int size) { cout << "Array:\n"; for (int i = 0; i < size; i++) { cout << arr[i] << endl; } } void printStats(int numRead, int numStored, int numDiscarded) { cout << "Stats:\n"; cout << "Text entries read: " << numRead << endl; cout << "Text entries stored: " << numStored << endl; cout << "Text entries discarded: " << numDiscarded << endl; } int getData(string arr[]) { ifstream inputFile("input.txt"); if (!inputFile.is_open()) { cout << "Error opening input file\n"; return 0; } int count = 0; string temp; while (inputFile >> temp && count < MAX_SIZE) { if (temp.length() > 3) { arr[count] = temp; count++; } else { cout << "Text entry discarded: " << temp << endl; } } if (inputFile.eof()) { cout << "End of input file reached\n"; } else { cout << "Input file too big for array\n"; } inputFile.close(); return count; } int main() { string arr[MAX_SIZE]; int size = 0; int numRead = 0, numStored = 0, numDiscarded = 0; while (true) { printMenu(); int choice; cin >> choice; if (cin.fail()) { cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cout << "Invalid input, please enter a number\n"; continue; } switch (choice) { case 1: size = getData(arr); numRead = MAX_SIZE; numStored = size; numDiscarded = MAX_SIZE - size; printArray(arr, size); break; case 2: printStats(numRead, numStored, numDiscarded); break; case 3: cout << "Exiting program\n"; return 0; default: cout << "Invalid choice, please try again\n"; break; } } return 0; } Inside of input.txt Spam Atmosphere Gym Space Science Movies Free Spam Entertainment Answer 5678.