i need help at figuring this out

so here is what i got as of right now
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//main.cpp
#include"city.h"
#include<string>
#include<iostream>
#include<vector>
using namespace std;

vector <int> readFileTask (string fname);
int main()
{ 
	vector<int> int_vec;
        vector <int> vector1;
       
        string fname;

        bool fileOK = false;// test the file whether it can be opened or not

        while(!fileOK){// while loop gets user input while try and catch handle file error.
                try
                {
                        cout << "Enter the name of the file to be opened: ";
                        cin>> fname;
                        int_vec = readFileTask(fname);
                        fileOK = true;
                }
                catch (invalid_argument & e)// catched invalid argument.
                {
                        cerr << "invalidargument_error: " << e.what() << endl;
                }
        }



and this what i need to do

how do i improvise it to meet this paticular requirement
The user should be prompted to enter the name of a file of cities. The file's contents should be read into the program's city vector, replacing its contents, if any. If the file does not exist or is formatted incorrectly the program's city vector should not be changed and the user should be prompted for a new file name. The first function will read a file of cities into a vector of cities and should have a string parameter that represents the name of the file to be opened and should return a vector of cities (vector <City>). This function should throw errors if the file cannot be opened or if it is formatted incorrectly. The second function would be responsible for requesting the file name and handling any errors.

File Format

Each city is recorded in a single line of the file with its name, latitude and longitude data separated by spaces. Here is the data from a small sample file, which you can find here. The format is name latitude longitude.

Calgary 51.1 -114.0167
Vancouver 49.1833 -123.167
Winnipeg 49.9 -97.2333
Ottawa 45.3167 -75.6667
Moose_Jaw 50.3333 -105.55
Topic archived. No new replies allowed.