I have a program that reads from a text file the name of a movie and fields related to that movie. I want to include those movies as a struct but I don't know how to initialize automatically.
This is my code to read from the txt file.
    string line;
    while (getline(z, line))
    {
        istringstream iss(line);
        int ane = line.find(";");
        string roa = line.erase(0, ane + 1);
        string actor = line.substr(0, ane);
        int mns = line.find_first_of("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM");
        string mn = roa.substr(mns);
        movies movie;
        construct(movie, actor);
    }
my struct:
struct movies {
    int rank;
    string title;
    string actor;
    float rating;
};
And I want to use a void function to do the initialization but it doesn't seem to work so I want to ask if it is possible to do it. Maybe by using vectors or pointers but I don't know how so I would appreciate it if you could tell me how it works.
 
     
    