please I need help ASAP

please I need to implement code using vector 2D Arry, this is my code but is wrong I don't why?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  #include <iostream>
#include <vector>

using namespace std;
int main(){
	int row = 5;
	int cols = 4;

	vector <vector<int>> matrix;
	
	for (row = 0; row > matrix; row++)
		matrix.push_back[row,cols];
	cout << "The value is" << endl;

	for (cols = 0; cols > matrix; cols++)
		cout << "The value is" << endl;



return 0;
}
.
please I need help
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
// 2D vector
 #include <iostream>
 #include <vector>
 using namespace std;
 int main()
 { 
	vector < vector<int> > vec;
	vector<int> v1{1,2,3};
	vector<int> v2{4,5,6};
	vector<int> v3{7,8,9};
	
	vec.push_back(v1);
	vec.push_back(v2);
	vec.push_back(v3);	
	
	for (int j=0; j<3 ; j++)
		{
			for (int k=0; k<3 ; k++)
			{
				cout << vec[j][k] << " ";
				if (k==2) cout << endl;
			}
		}	
	
 return 0;	
 }
I got many errors in your code

1>------ Build started: Project: Vector, Configuration: Debug Win32 ------
1> Main.cpp
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(7): error C2601: 'v1' : local function definitions are illegal
1> c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(5): this line contains a '{' which has not yet been matched
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(7): error C2143: syntax error : missing ';' before '}'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(8): error C2470: 'v2' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(9): error C2470: 'v3' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(11): error C2065: 'vec' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(11): error C2228: left of '.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(11): error C2065: 'v1' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(12): error C2065: 'vec' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(12): error C2228: left of '.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(12): error C2065: 'v2' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(13): error C2065: 'vec' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(13): error C2228: left of '.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(13): error C2065: 'v3' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(15): error C2143: syntax error : missing ')' before ';'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(15): error C2143: syntax error : missing ';' before ')'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(15): error C2143: syntax error : missing ';' before ')'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(15): error C2065: 'j' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(15): error C2065: 'j' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(15): error C2059: syntax error : ')'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(16): error C2143: syntax error : missing ';' before '{'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(17): error C2143: syntax error : missing ')' before ';'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(17): error C2143: syntax error : missing ';' before ')'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(17): error C2143: syntax error : missing ';' before ')'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(17): error C2065: 'k' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(17): error C2065: 'k' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(17): error C2059: syntax error : ')'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(18): error C2143: syntax error : missing ';' before '{'
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(19): error C2065: 'vec' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(19): error C2065: 'j' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(19): error C2065: 'k' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(20): error C2065: 'k' : undeclared identifier
1>c:\users\naif\documents\visual studio 2010\projects\vector\vector\main.cpp(22): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

your compiler doesn't support C++11
compile in http://cpp.sh/
use Orwell Dev C++ or Code::Blocks IDE.
Topic archived. No new replies allowed.