Compiler Errors - Function Calls

I have a main.cc class and a database.cc class (which includes the header implementation, not allowed to separate into a .h file) that won't compile. I get errors for most function calls e.g. database.cc:57:32: error: too many arguments to function call, expected single argument '__x', have 3 arguments
flist.push_back(fname, lname, destination);

Any help on how to get these two classes to compile together without changing anything in the main.cc file would be incredibly appreciated.

main.cc
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "database.cc"

int main()
{
	list<Passenger> flight_list;
	string first_name, last_name, destination;

	while (true) 
	{
		switch (menu())
		{
			case 1:	
				{
					read_from_file(flight_list, "ticket_reservations.dat");
					break;
				}

			case 2: 
				{
					cout << "name of passenger:" << endl; 
					cin >> first_name >> last_name;
					cout << "destination:" << endl;
					cin.ignore();
					getline(cin, destination);
					insert(flight_list, first_name, last_name, destination);
					break;
				}

			case 3: 
				{
					cout << "name of passenger:" << endl;
					cin >> first_name >> last_name;
					remove(flight_list, first_name, last_name);
					break;
				}

			case 4: 
				{
					cout << "name of passenger:" << endl;
					cin >> first_name >> last_name;
					if (check_reservation(flight_list, first_name, last_name))
						cout << "this passenger has a ticket reservation" << endl;
					else
						cout << "this passenger does not have a ticket reservation" << endl;
					break;
				}

			case 5:	
				{
					display_list(flight_list);
					break;
				}

			case 6: 
				{
					save_to_file(flight_list, "ticket_reservations.dat");
				}
				break;

			case 7:
				return 0;
		}
	}
	
	return 0;
}



database.cc
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<fstream>
using namespace std;

class Passenger {
public:
    Passenger() {}
    Passenger(string first, string last, string dest) 
    {  
    	fname = first;
    	lname = last;
    	destination = dest;
    }
    bool operator==(const Passenger& p) const
	{
    	return fname == p.fname && lname == p.lname;
	}
    bool operator<(const Passenger& p) const
	{
    	return fname < p.fname || (fname == p.fname && lname < p.lname);
	}
    void print(std::ostream& os)
	{
    	os << fname << ' ' << lname << ' ' << destination << '\n';
	}

private:
    string fname, lname, destination;
};

int menu()
{
    int option;
    cout << endl;
    cout << "Enter one of the following options:" << endl;
    cout << "1. load reservations from file:" << endl;
    cout << "2. reserve a ticket" << endl;
    cout << "3. cancel a reservation" << endl;
    cout << "4. check reservation" << endl;
    cout << "5. display passenger list" << endl; 
    cout << "6. save passenger list" << endl;
    cout << "7. exit" << endl << endl;
    cin >> option;
    cin.get();
    return option;
}

void read_from_file(list<Passenger>& flist, string filename)
{
    string fname, lname, destination;
    std::ifstream input(filename.c_str());
    while (input >> fname >> lname >> destination) 
    {                   
        flist.push_back(fname, lname, destination);
    }
    input.close();
}

void insert(list<Passenger>& flist, string fname, string lname, string destination)
{
    flist.push_back(fname, lname, destination);
}

void remove(list<Passenger>& flist, string fname, string lname)
{
    flist.remove(fname, lname);
}

bool check_reservation(list<Passenger>& flist, string fname, string lname)
{
    list<Passenger>::iterator i1, i2;
    i1 = flist.begin();
    i2 = flist.end();
    return flist.end() != find(flist.begin(), flist.end(), (string fname, string lname));
}

void display_list(list<Passenger>& flist)
{
    flist.sort();
    list<Passenger>::iterator i1, i2;
    i1 = flist.begin();
    i2 = flist.end();
    for ( ; i1 != i2; ++i1) {
        i1->print(cout);
    }
}

void save_to_file(list<Passenger>& flist, string filename)
{
    flist.sort();
    list<Passenger>::iterator i1, i2;
    i1 = flist.begin();
    i2 = flist.end();
    std::ofstream output(filename.c_str());
    for ( ; i1 != i2; ++i1) {
        i1->print(output);
    }
    output.close();
}



Thanks!
flist.push_back( Passenger(fname, lname, destination) );
Topic archived. No new replies allowed.