hello;
i've been programming with c++ for about 2 months, BRAND new at this, im currently making a text based RPG for one of my programming classes. im having trouble with a error that comes up, and no one in my class can find out what exactly is the problem...
what exactly this code is doing: it is making a 15X15 map on the screen, with an "X" for where your current position is.
error:
o:\ics3u1\cpp\tasks_jonathanyoung\textbaserpg\main.cpp(192): error C2143: syntax error : missing ';' before ']'

NOTE: this error occurs from lines 184 to 198.
NOTE: this is only one function of about 25.... i didnt want to post the whole code so not all includes may be needed.

#define UP_ARROW    72
#define LEFT_ARROW  75
#define DOWN_ARROW  80
#define RIGHT_ARROW 77

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <string>
#include <time.h>
#include <conio.h>

using namespace std;

void mapcreate()
{
	bool boolmapon = true;

	char intmap[15][15];
	int intCharX = 7;
	int intCharY = 7;
	char KeyStroke;

	while(boolmapon == true)
	{

		for(;;)
		{
			intmap[intCharX][intCharY] = 'X'; 

			cout << "|--------------------------------------|\n";
			cout << "|" << intmap[0][0] << intmap[0][1] << intmap[0][2] << intmap[0][3] << intmap[0][4] << intmap[0][5] << intmap[0][6] << intmap[0][7] << intmap[0][8]] << intmap[0][9] << intmap[0][10] << intmap[0][11] << intmap[0][12] << intmap[0][13] << intmap[0][14] << "|" << endl;
			cout << "|" << intmap[1][0] << intmap[1][1] << intmap[1][2] << intmap[1][3] << intmap[1][4] << intmap[1][5] << intmap[1][6] << intmap[1][7] << intmap[1][8]] << intmap[1][9] << intmap[1][10] << intmap[1][11] << intmap[1][12] << intmap[1][13] << intmap[1][14] << "|" << endl;
			cout << "|" << intmap[2][0] << intmap[2][1] << intmap[2][2] << intmap[2][3] << intmap[2][4] << intmap[2][5] << intmap[2][6] << intmap[2][7] << intmap[2][8]] << intmap[2][9] << intmap[2][10] << intmap[2][11] << intmap[2][12] << intmap[2][13] << intmap[2][14] << "|" << endl;
			cout << "|" << intmap[3][0] << intmap[3][1] << intmap[3][2] << intmap[3][3] << intmap[3][4] << intmap[3][5] << intmap[3][6] << intmap[3][7] << intmap[3][8]] << intmap[3][9] << intmap[3][10] << intmap[3][11] << intmap[3][12] << intmap[3][13] << intmap[3][14] << "|" << endl;
			cout << "|" << intmap[4][0] << intmap[4][1] << intmap[4][2] << intmap[4][3] << intmap[4][4] << intmap[4][5] << intmap[4][6] << intmap[4][7] << intmap[4][8]] << intmap[4][9] << intmap[4][10] << intmap[4][11] << intmap[4][12] << intmap[4][13] << intmap[4][14] << "|" << endl;
			cout << "|" << intmap[5][0] << intmap[5][1] << intmap[5][2] << intmap[5][3] << intmap[5][4] << intmap[5][5] << intmap[5][6] << intmap[5][7] << intmap[5][8]] << intmap[5][9] << intmap[5][10] << intmap[5][11] << intmap[5][12] << intmap[5][13] << intmap[5][14] << "|" << endl;
			cout << "|" << intmap[6][0] << intmap[6][1] << intmap[6][2] << intmap[6][3] << intmap[6][4] << intmap[6][5] << intmap[6][6] << intmap[6][7] << intmap[6][8]] << intmap[6][9] << intmap[6][10] << intmap[6][11] << intmap[6][12] << intmap[6][13] << intmap[6][14] << "|" << endl;
			cout << "|" << intmap[7][0] << intmap[7][1] << intmap[7][2] << intmap[7][3] << intmap[7][4] << intmap[7][5] << intmap[7][6] << intmap[7][7] << intmap[7][8]] << intmap[7][9] << intmap[7][10] << intmap[7][11] << intmap[7][12] << intmap[7][13] << intmap[7][14] << "|" << endl;
			cout << "|" << intmap[8][0] << intmap[8][1] << intmap[8][2] << intmap[8][3] << intmap[8][4] << intmap[8][5] << intmap[8][6] << intmap[8][7] << intmap[8][8]] << intmap[8][9] << intmap[8][10] << intmap[8][11] << intmap[8][12] << intmap[8][13] << intmap[8][14] << "|" << endl;
			cout << "|" << intmap[9][0] << intmap[9][1] << intmap[9][2] << intmap[9][3] << intmap[9][4] << intmap[9][5] << intmap[9][6] << intmap[9][7] << intmap[9][8]] << intmap[9][9] << intmap[9][10] << intmap[9][11] << intmap[9][12] << intmap[9][13] << intmap[9][14] << "|" << endl;
			cout << "|" << intmap[10][0] << intmap[10][1] << intmap[10][2] << intmap[10][3] << intmap[10][4] << intmap[10][5] << intmap[10][6] << intmap[10][7] << intmap[10][8]] << intmap[10][9] << intmap[10][10] << intmap[10][11] << intmap[10][12] << intmap[10][13] << intmap[10][14] << "|" << endl;
			cout << "|" << intmap[11][0] << intmap[11][1] << intmap[11][2] << intmap[11][3] << intmap[11][4] << intmap[11][5] << intmap[11][6] << intmap[11][7] << intmap[11][8]] << intmap[11][9] << intmap[11][10] << intmap[11][11] << intmap[11][12] << intmap[11][13] << intmap[11][14] << "|" << endl;
			cout << "|" << intmap[12][0] << intmap[12][1] << intmap[12][2] << intmap[12][3] << intmap[12][4] << intmap[12][5] << intmap[12][6] << intmap[12][7] << intmap[12][8]] << intmap[12][9] << intmap[12][10] << intmap[12][11] << intmap[12][12] << intmap[12][13] << intmap[12][14] << "|" << endl;
			cout << "|" << intmap[13][0] << intmap[13][1] << intmap[13][2] << intmap[13][3] << intmap[13][4] << intmap[13][5] << intmap[13][6] << intmap[13][7] << intmap[13][8]] << intmap[13][9] << intmap[13][10] << intmap[13][11] << intmap[13][12] << intmap[13][13] << intmap[13][14] << "|" << endl;
			cout << "|" << intmap[14][0] << intmap[14][1] << intmap[14][2] << intmap[14][3] << intmap[14][4] << intmap[14][5] << intmap[14][6] << intmap[14][7] << intmap[14][8]] << intmap[14][9] << intmap[14][10] << intmap[14][11] << intmap[14][12] << intmap[14][13] << intmap[14][14] << "|" << endl;
			cout << "|--------------------------------------|\n";

			intmap[intCharX][intCharY] = ' '; 

			KeyStroke =	getch();


			KeyStroke = getch(); 
			switch (KeyStroke)
			{
			case UP_ARROW:
				intCharY ++;
				break;
			case DOWN_ARROW:
				intCharY--;
				break;
			case LEFT_ARROW:
				intCharX --;
				break;
			case RIGHT_ARROW:
				intCharX++;
				break;
			default:
				cout << "another key please" << endl;
			}	
		}
	}
}

Edited 7 Years Ago by jonathanYoung: n/a

ouch that hurts my eyes. WHY aren't you using loops ?

do
{
    for(int i = 0; i < 15; i++){
            cout<<"|";
          for(int j = 0; j < 15; j++){
               cout<<intmap[i][j];
             }
           cout<<"|";
         }

   //rest of you code for input
}while(true)

Your teacher would fail you if she had seen that. make change ASAP.

Edited 7 Years Ago by firstPerson: n/a

ouch that hurts my eyes. WHY aren't you using loops ?

do
{
    for(int i = 0; i < 15; i++){
            cout<<"|";
          for(int j = 0; j < 15; j++){
               cout<<intmap[i][j];
             }
           cout<<"|";
         }

   //rest of you code for input
}while(true)

Your teacher would fail you if she had seen that. make change ASAP.

ohhhhh snap
i did not even think of it
and my teachers retarded cause he couldn't help me with this either... all he does is sit in class and play video games baha...
thanks for your help : ]

This article has been dead for over six months. Start a new discussion instead.