I want to make a simple programm that shows a square of 16 'X' and that you can change specific coordinates. Everything is finished and i dont get any bugreports but in the programm things are very strange. what i should get is easy
XXXX
XXXX
XXXX
XXXX
and if i change 1,1 to A i should have this
AXXX
XXXX
XXXX
XXXX
but what i see when i run the program is this:
XXXX
XXXX
XXXX
@
well what is with the fourth line? there is a smiley in the first spot (i used an @) and the rest is empty. when i change 1,1 to anything, 3,4 changes too. everything else works properly. and if i try to change something in the fourth line the program crashes. if you want to test it yourself i can upload the .exe #include
using namespace std;
int main()
{
for (;;) {
int eingabe1;
int eingabe2;
char neueingabe;
char array[4][4];
array[1][1] = 'X';
array[1][2] = 'X';
array[1][3] = 'X';
array[1][4] = 'X';
array[2][1] = 'X';
array[2][2] = 'X';
array[2][3] = 'X';
array[2][4] = 'X';
array[3][1] = 'X';
array[3][2] = 'X';
array[3][3] = 'X';
array[3][4] = 'X';
array[4][1] = 'X';
array[4][2] = 'X';
array[4][3] = 'X';
array[4][4] = 'X';
cout << "koordinaten eingeben" << endl;
cin >> eingabe1;
cin >> eingabe2;
cout << array[eingabe1][eingabe2] << endl;
cout << "neueingabe eingeben" << endl;
cin >> neueingabe;
array[eingabe1][eingabe2] = neueingabe;
cout << array[eingabe1][eingabe2]<< endl;
}
return 0;
}
i hope you can help