Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Description of the data file ( data.txt) - Format of the table: Country Year Lif

ID: 3617617 • Letter: D

Question

Description of the data file (data.txt)

- Format of the table:

Country Year     Life_exp_both_sexes       Life_exp_male         Life_exp_female

Life_exp: Life expectancy

- The format of the table has been simplified so that all country names consist of only a single word.

- You may assume that the number of countries in the data file never exceeds 500.

Option 1: If the user selects 1, then the program asks the user to enter the filename of the data file. If the file exists, then the program loads the data into an array of structured data (struct) and prints the number of entries; otherwise, it prints out an error message. After that, the program displays the main menu again.

1. Load data from file

Please enter the data filename: wrong.txt

Error in opening wrong.txt

1. Load data from file

Please enter the data filename: data.txt

222 entries read successfully

Option 2: If the user selects 2:

- If the data has been read by the program, then the program asks the user to enter a country name. If the input country name is found (use the binary search algorithm), the program displays the corresponding data; otherwise, it prints out a message saying that the country is not found.

- If the data has not been read by the program, then the program asks the user to load data from file first.

- After that, the program is back to the main menu.

Suppose the user has not selected option 1 (has not read the data from file):

2. Search data by country

Please enter a country name: Canada

Data has not been loaded.

Please load data from file first (select option 1).

Suppose the user has selected option 1 (has read the data from file):

2. Search data by country

Please enter a country name: Canada

Canada 2007

Life exp. both sexes: 80.3

Life exp. male: 77

Explanation / Answer

x.Xlor="red">please rate - thanks #include #include using namespace std; struct life_exp { string name; int year; double both; double male; double female; } life[500],temp; int menu(); int main() { ifstream in; ofstream out; char filename[30]; string key; int low,max,mid; int i,j,count,choice; bool input=false,found,sorted=false; for(;;)    {choice=menu();     switch(choice)     {case 1:coutfilename;             in.open(filename);             if(in.fail())                           {coutlife[count].male;                     in>>life[count].female;                     count++;                    in>>life[count].name;                    }                    cout