hi,
I am new to programming ! I am just writing match game ! I am trying to move the letter to concerning place .. so I created two dimen-array for it .. but I have problem with moving those to concerning place .. here is my some code of that ... plese help me out to work.. thanks in advance..
code:

#include
using namespace std;
void display(void);//Show the table that have card name in side
void moveCard();
//void playagian();


//===========================================================================================================
char way;
const int ORDER=3;//row number
const int COLUM=4;//colum number
char cardname[][ORDER][COLUM]={"D2","S4","H6","C5","D2","S4","AD","C5","H6","__","AD",}; // char name of card

//===========================================================================================================

int main()
{
cout << endl;
cout << endl;
cout <<" ----->>>>> Match Game <<<<<----- ";
cout << endl;
cout << endl;
cout <<"________________________________________________" << endl;
for(int head =0; head<4; head++)

cout << " | " << head << " |";
cout << endl;
cout <<"________________________________________________" << endl;
display();
cout <<"________________________________________________";
cout << endl;
cout << endl;
cout << " what you want to move?? ";
cout << endl;
cout << endl;
cin >> cardname[ORDER][COLUM];
cout << endl;
cout << endl;
cout << "What you want to go right,left, up,down" << endl ;
cin >> way;
cout << endl;
cout << endl;
moveCard();
cout << endl;
cout << endl;
//playagain();
cout << endl;
return 0;

}
//===========================================================================================================


void display(void)
{


for (int i=0;i

>>cin >> cardname[ORDER][COLUM];
I don't understand the problem you are trying to explain. But above line is certainly wrong. The array has 3 rows and 4 columns. Rows are numbered 0, 1 and 2, and the columns are numberd 0, 1, 2, and 3. The line above is trying to access row 3 and column 4 which do not exist.

The second problem with that line is that it will alow you to enter a something from the keyboard that will destroy whatever was in there before. If that was your intent then its ok.

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