set value in tow dimensional array as stating point

hello
i have a project in my class

and i have to build 2D array n*n and n value must enterd by the user

after that i have to ask the user to enter the starting and the ending points
then i have to make a robot to walk from the starting point to the ending point
automatically

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
#include<iostream>
#include <cstdlib>
#include <ctime>
#include "node.h"
using namespace std;

int main ()
{
	int n , m ,x , y , w , z , s , e , o , k , l , ** Array ;
	cout<<"Please Enter The Value Of The Columns :  "  << endl;
	cin>>n;
	{
	m=n;
	Array = new int*[n];
    for(int i = 0; i < n; ++i)
    Array[i] = new int[m];
    }   
	cout<<"What Is The Starting Point ??"<<endl;
	cin>> x;
	cin>> y;
	Array[x][y]={6};
	cout<<"What Is The Ending Point ??"<<endl;
	cin>> w ;
	cin>> z ;
	e=Array[w][z];
	e=6;
		for(int i=0; i<n; i++)    //This loops on the rows.
	{
		for(int j=0; j<n; j++) //This loops on the columns
		{
			cout << Array[i][j]  << "  ";
		}
		cout << endl;
	}
	/*
	srand(time(0));
	o=(n*n)/4;
	Array[k][l]= (rand()%o) ;
	for (int i=0 ; i < o ; i++)
	{
		cout<< Array[k][l]<<endl;
	}	*/
	getchar();
	return 0;
}


my question is how to define the starting and ending points and there value enter by the user ??

and my second question is my code good or not ??

and i get this error in line 21

21 16 extended initializer lists only available with -std=c++11 or -std=gnu++11
Last edited on
Topic archived. No new replies allowed.