Vector of Vectors Problem

Hey guys! My question concerns an issue I'm having with my code. I'm writing a program that creates vectors for class test scores. It takes user input for the size of the class and question amount.



I get a e0304 error from the compiler that tells me the overloaded function doesnt match the argument list. This error occurs right at the "." of the line with "c_results.push_back(temp);"

Temp and c_results are both vector<int>'s. Am I missing something here?

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
  void testing(int x, int y, vector<int>& c_results) {

	int q_score = 0;

	while (x <= 0);

	for (int i = 0; i < x; i++) {
		vector<int> temp;

		for (int j = 0; j < y; j++) {
			cout << "What was the student's score for question " 
                        << j + 1 << "? (On a scale of 1-5)";

			cin >> q_score;

			temp.push_back(q_score);

			if (q_score < 1 or q_score > 5) {
				cout << "Invalid score...please try again." 
                              << endl;
				break;
			}
		}

		c_results.push_back(temp);
	}	
}
Found out my issue after looking at my code. Didn't create the vector of vectors correctly.

vector<int>c_results -> vector<vector<int>c_results.
Topic archived. No new replies allowed.