(this program reads a txt file of popular baby names and when user…

Question Answered step-by-step (this program reads a txt file of popular baby names and when user… (this program reads a txt file of popular baby names and when user inputs name it states if it was popular in the past 100 years) how do i add into this program that if the name is on the array then to :—Returns, in a full sentence(s), the first year in which that name was most popular and how many times it has been the most popular name. if the name is not read on the array the to:—Returns a statement telling the user that the name has not been one of the most popular names in the last 100 years.  #include #include using namespace std;const int NUM = 110;// driver functionint main(){    // variable declarations    string names[NUM][2], filename, header, gender;    int year, i = 0;    char ch = ‘Y’;    // Welcome the user    cout << "Welcome to the popular baby name findernn";    // introduce the purpose of the application     cout << "The program displays the top male/female name of the desired yearn";    cout << "The program asks if the user wishes to continue.nn";    // prompt the user for the input file    cout << "Please tell me the name of the file to read in :t";    cin >> filename;    // opening a file for reading    ifstream f(filename, ios::in);    // checking if the file opened successfully    if (!f.is_open())    {        cout << "Error: Could not open the input file!nExiting....n";        exit(1);    }    // read the header of the file    getline(f, header);    // start reading the file    while (f >> year >> names[i][0] >> names[i][1])    {        // increment i        i++;    }    // closing the input file    f.close();    cout << "nMatrix was successfully read in from the filenn";    while (ch == 'Y' || ch == 'y')    {        cout << "Enter a namen";        cin >> names;                       cout << "Would you like to search for another name (Y/N)?:t";        cin >> ch;    }    return 0;}  this is the txt file:Year Female Male1915 Mary John1916 Mary John1917 Mary John1918 Mary John1919 Mary John1920 Mary John1921 Mary John1922 Mary John1923 Mary John1924 Mary Robert1925 Mary Robert1926 Mary Robert1927 Mary Robert1928 Mary Robert1929 Mary Robert1930 Mary Robert1931 Mary Robert1932 Mary Robert1933 Mary Robert1934 Mary Robert1935 Mary Robert1936 Mary Robert1937 Mary Robert1938 Mary Robert1939 Mary Robert1940 Mary James1941 Mary James1942 Mary James1943 Mary James1944 Mary James1945 Mary James1946 Mary James1947 Linda James1948 Linda James1949 Linda James1950 Linda James1951 Linda James1952 Linda James1953 Mary Robert1954 Mary Michael1955 Mary Michael1956 Mary Michael1957 Mary Michael1958 Mary Michael1959 Mary Michael1960 Mary David1961 Mary Michael1962 Lisa Michael1963 Lisa Michael1964 Lisa Michael1965 Lisa Michael1966 Lisa Michael1967 Lisa Michael1968 Lisa Michael1969 Lisa Michael1970 Jennifer Michael1971 Jennifer Michael1972 Jennifer Michael1973 Jennifer Michael1974 Jennifer Michael1975 Jennifer Michael1976 Jennifer Michael1977 Jennifer Michael1978 Jennifer Michael1979 Jennifer Michael1980 Jennifer Michael1981 Jennifer Michael1982 Jennifer Michael1983 Jennifer Michael1984 Jennifer Michael1985 Jessica Michael1986 Jessica Michael1987 Jessica Michael1988 Jessica Michael1989 Jessica Michael1990 Jessica Michael1991 Ashley Michael1992 Ashley Michael1993 Jessica Michael1994 Jessica Michael1995 Jessica Michael1996 Emily Michael1997 Emily Michael1998 Emily Michael1999 Emily Jacob2000 Emily Jacob2001 Emily Jacob2002 Emily Jacob2003 Emily Jacob2004 Emily Jacob2005 Emily Jacob2006 Emily Jacob2007 Emily Jacob2008 Emma Jacob2009 Isabella Jacob2010 Isabella Jacob2011 Sophia Jacob2012 Sophia Jacob2013 Sophia Noah2014 Emma Noah2015 Emma Noah2016 Emma Noah2017 Emma Liam2018 Emma Liam2019 Olivia Liam  Computer Science Engineering & Technology C++ Programming GE 1501 Share QuestionEmailCopy link Comments (0)