#include <iostream>
#include <fstream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
struct football_game
{
    string visit_team;
    int home_score;
    int visit_score;
};
void printMenu();
int main()
{
    int i, totalValues = 0;
    ifstream inputFile;
    string temp = "";
    inputFile.open("games.txt");
    if (!inputFile)
    {
        cout << "Error opening Input file!" << endl;
        exit(101);
    }
    inputFile >> totalValues;
    getline(inputFile, temp);
    cout << "                            *** Football Game Scores *** " << endl << endl;
    cout << " * Total Number of teams : " << totalValues << endl << endl;
    football_game* records = new football_game[totalValues];
    // while (!inputFile.eof())
    // {// == NULL) {
    for (i = 0; i < totalValues; i++)
    {
        getline(inputFile, records[i].visit_team);
        cout << records[i].visit_team << endl;
        inputFile >> records[i].home_score >> records[i].visit_score;
        cout << records[i].home_score << "  " << records[i].visit_score << endl;
        getline(inputFile, temp);
    }
    //}
    cout << endl;
    int choice = 0;
    int avg_home_Score = 0;
    int avg_visit_Score = 0;
    printMenu(); // prints menu
    cout << "Please Enter a choice from the Menu : ";
    cin >> choice;
    cout << endl << endl;
    while (true)
    {
        switch (choice)
        {
            case 1:
                cout << "               Score Table " << endl;
                cout << "         ***********************" << endl << endl;
                cout << "        VISIT_TEAM"
                     << "      "
                     << " HIGH_SCORE"
                     << "   "
                     << "VISIT_SCORE " << endl;
                cout << "       -----------"
                     << "      "
                     << "-----------"
                     << "  "
                     << "------------" << endl;
                for (int i = 0; i < totalValues; i++)
                {
                    cout << '|' << setw(18) << left << records[i].visit_team << "    " << '|'
                         << setw(7) << right << records[i].home_score << "     " << '|' << setw(7)
                         << right << records[i].visit_score << "     " << '|' << endl;
                }
                cout << endl << endl << endl;
                break;
            case 2:
            {
                string team_name;
                cout << "Enter the Team Name  :  ";
                cin >> team_name;
                for (int i = 0; i < totalValues; i++)
                {
                    if (records[i].visit_team == team_name)
                    {
                        cout << "        VISIT_TEAM"
                             << "      "
                             << " HIGH_SCORE"
                             << "   "
                             << "VISIT_SCORE " << endl;
                        cout << "       -----------"
                             << "      "
                             << "-----------"
                             << "  "
                             << "------------" << endl;
                        cout << '|' << setw(18) << left << records[i].visit_team << "    " << '|'
                             << setw(7) << right << records[i].home_score << "     " << '|'
                             << setw(7) << right << records[i].visit_score << "     " << '|'
                             << endl;
                    }
                }
                cout << endl;
                break;
            }
            case 3:
            {
                for (int i = 0; i < totalValues; i++)
                    avg_home_Score += records[i].home_score;
                cout << "Average home_score: " << (avg_home_Score / totalValues) << endl << endl;
                break;
            }
            case 4:
            {
                for (int i = 0; i < totalValues; i++)
                    avg_visit_Score += records[i].visit_score;
                cout << "Average visit_score: " << (avg_visit_Score / totalValues) << endl << endl;
                break;
            }
            default:
            {
                cout << "Please enter valid input !!" << endl;
                break;
            }
        }
        printMenu();
        cin >> choice;
    }
    return 0;
}
void printMenu()
{
    cout << "                      Menu Options                 " << endl;
    cout << "                    ================               " << endl;
    cout << "     1. Print Information of all Games[Table Form] " << endl;
    cout << "     2. Print Information of a Specific Game       " << endl;
    cout << "     3. Print Average points scored by the Home Team during season" << endl;
    cout << "     4. Print Average points scored against the Home Team" << endl << endl << endl;
}
Here is the input file i am using
games.txt
5
SD Mines
21 17
Northern State
10 3
BYU
10 21
Creighton
14 7
Sam Houston State
14 24
When i am using the 2nd option (Print Information of a Specific Game) from the output screen, it ask me to enter the team name and when i enter the team-name. For example: SD Mines it gives me an error, but when I enter the team-name with no space like: BYU it works fine for me.
 
     
     
     
     
    