Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
761 B
0
Indexable
Never
	vector<Passenger> passengers_solution; 
	ifstream file;
	file.open(passengers_azienda);
	if (file.fail()) {
		cerr << "Error Opening File passenger azienda" << endl;
		system("pause");
		exit(1);
	}
	while (!file.eof()) {
		string row;
		getline(file, row);
		vector<string> e = split(row, ';');
		int min_dep;
		int min_arr;
		
		if (e[2] != "Charter") {
			vector<string> dep_min = split(e[4], ':');

			min_dep = (stoi(dep_min[0]) * 60) + stoi(dep_min[1]);
			vector<string> arr_min = split(e[5], ':');

			min_arr = (stoi(arr_min[0]) * 60) + stoi(arr_min[1]);
		}
		else {
			min_arr = 0;
			min_dep = 0;
		}
		Passenger p(0, 0, 0, e[0], e[2], e[3], "", e[1], "", "", min_dep, min_arr);
		//p.print();
		passengers_solution.push_back(p);

	}
	file.close();