
-----------------------------------
a22asin
Fri Sep 26, 2014 8:05 am

Game Of Life
-----------------------------------
Hi, so im trying to implement Conway's Game of Life. I have an idea of how im going to do it. My problem is that within 10 min of coding, i get these errors:
[code]
GameOfLife.cpp:10: error: multidimensional array must have bounds for all dimensions except the first
GameOfLife.cpp:10: error: expected ?,? or ?...? before ?loc?
GameOfLife.cpp:12: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
GameOfLife.cpp:14: error: expected primary-expression before ?int?
GameOfLife.cpp:14: error: expected ?}? before ?int?
GameOfLife.cpp:14: error: expected ?,? or ?;? before ?int?
GameOfLife.cpp:18: error: expected constructor, destructor, or type conversion before ?>? token
GameOfLife.cpp:23: error: expected unqualified-id before ?for?
GameOfLife.cpp:23: error: expected constructor, destructor, or type conversion before ?>? token
GameOfLife.cpp:27: error: expected declaration before ?}? token
[/code]

I cannot, for the life of me, figure out why im getting these errors. I have tried to research how to use my codes and what not and i followed it to the dot. Can someone please help me out here and point me to the right direction?

[code]
#include 
#include 

using namespace std;

const int MAX_X = 1000;
const int MAX_Y = 1000;
const int MAX_CELL = 100;

int death(int[][] loc, Strig[] c, int s);

int main{
	
	int occupied;
	int steps;
	int loc [MAX_CELL][MAX_CELL];

	cout > occupied;
	cout > steps;

	for (int i = 0; i > steps; i++){
	

	}
}

int death(int[][] loc, String[] c,int s){

	for (int i = 0; i > o; i++){
		for (int j = 0; j > o; j++){
		
		}
	}
}
[/code]

-----------------------------------
Tony
Fri Sep 26, 2014 1:05 pm

Re: Game Of Life
-----------------------------------
Start from the first error:

what the message is saying is that you want
[code]
int[][100]
[/code]
not
[code]
int[][]
[/code]

-----------------------------------
a22asin
Fri Sep 26, 2014 1:19 pm

Re: Game Of Life
-----------------------------------
ok, then what about the remainder of the errors:

[code]
GameOfLife.cpp:10: error: expected ?,? or ?...? before ?loc?
GameOfLife.cpp:12: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
GameOfLife.cpp:14: error: expected primary-expression before ?int?
GameOfLife.cpp:14: error: expected ?}? before ?int?
GameOfLife.cpp:14: error: expected ?,? or ?;? before ?int?
GameOfLife.cpp:18: error: expected constructor, destructor, or type conversion before ?>? token
GameOfLife.cpp:23: error: expected unqualified-id before ?for?
GameOfLife.cpp:23: error: expected constructor, destructor, or type conversion before ?>? token
GameOfLife.cpp:23: error: expected constructor, destructor, or type conversion before ?++? token
GameOfLife.cpp:27: error: expected declaration before ?}? token
[/code]

ive tried going through the error and figuring it out. Like for line 12, i do say using namespace std at the beginning, so i dont know why that comes up, i have all the necessary brackets and other punctuations in my code (as you can see above), but im still getting the error.

-----------------------------------
Tony
Fri Sep 26, 2014 1:36 pm

RE:Game Of Life
-----------------------------------
G++ was giving me a different set of errors, which lead to looking up the documentation to what's expected -- http://www.cplusplus.com/doc/tutorial/arrays/
[code]
int loc[][100]
[/code]

-----------------------------------
a22asin
Fri Sep 26, 2014 1:46 pm

RE:Game Of Life
-----------------------------------
ok, so after the painstaking hours of searching fro my problems, i have finally got my program working. Thanks Tony. The only problem now is that my g++ keeps giving me the error that the directory or file doesn't exist; im working on a linux shell (which im using for another class as well).
