0

需要对我拥有的 Film 对象使用矢量。向我抛出错误并且不确定需要将东西移动到哪里或者我是否命名错误。可能是显而易见的事情。

代码:

#include "std_lib_facilities.h"

int main() 
{ 

    class Film 
    {
    public:
        Film();
        Film(string sl, string el);

    };

    cout << "Please enter first film:\n";
    string start_film;
    cin >> start_film;
    cout << "\nPlease enter a second film:\n";
    string end_film;
    cin >> end_film;
    cout << "\nPlease enter a date (format = dd/mm/yyyy):\n";
    string date;
    cin >> date;

    string name;
    name = "films.txt";
    ifstream ist(name.c_str());

    if (!ist)
        error("Cannot open output file " + name);

    vector<Film> temps; // create a vector to store the readings
    string film;
    string director;
    float rating;
    int year;
    int date;

    while (ist >> film >> director >> rating >> year >> date) 
    { // read
        // check
        temps.push_back(Film(film,director, rating, year, date)); // store
    }

    cout << "Start: " + start_film + " End: " + end_filmn + " Date: " + date + "\n";

    keep_window_open();
    return 0;
}

非常感谢任何可以指出的结构错误或关于去哪里的建议。

警告:

main::Flight::Flight 本地类成员函数没有主体错误:main::Flight::Flight:没有重载函数需要 5 个参数

4

0 回答 0