Good afternoon I'm programming a soup of letters in c ++ that shows on the screen the matrix with all the letters. I must be able to go through the matrix with the arrow keys and by pressing enter on a letter that is between the accepted ones, change it until all the letters of the word are completed.
They recommended me to do it with sprites with two matrices.
The problem I have is that I can not go through the matrix and change the colors of the letters I select with enter.
I made a matrix with the letters and another with the same dimensions to go through it.
If someone can help me to effectively tour the matrix, thank you very much.
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <ctype.h>
#include <string.h>
char sop[10][10]={{'M','M','L','E','E','N','A','E','V','E'},
{'E','R','H','O','N','G','O','S','T','R'},
{'X','X','O','T','I','R','R','A','C','A'},
{'I','S','A','P','P','O','T','A','P','S'},
{'C','C','M','L','A','A','I','Z','O','T'},
{'O','A','A','U','A','N','U','L','P','U'},
{'S','O','M','B','R','E','R','O','M','P'},
{'C','N','E','A','R','R','I','I','O','O'},
{'W','O','J','E','N','O','C','P','Z','E'},
{'A','A','Z','A','A','L','N','Y','T','D'}};
char moverFlechas[10][10];
int x = 1;
int y = 1;
void main()
{
int myChar;
int f,c,i;
textbackground(BLACK);
textcolor(WHITE);
for(f=0;f<10;f++)
{
for(c=0;c<10;c++)
{
gotoxy((c+3)*2,(f+1)*2);cprintf("%c",sop[f][c]);
}
}
do {
myChar = getch();
if (myChar == 224) {
myChar = getch();
} else {
if (myChar == 72) {
cprintf("Up Arrow");
y=y-1;
cprintf("x %c",moverFlechas[x][y]);
} else if (myChar == 80) {
cprintf("Down Arrow");
y=y+1;
cprintf("x %c",moverFlechas[x][y]);
} else if (myChar == 75) {
cprintf("Left Arrow");
x=x-1;
cprintf("x %c",moverFlechas[x][y]);
} else if (myChar == 77) {
cprintf("Right Arrow");
x=x+1;
cprintf("x %c",moverFlechas[x][y]);
}
}
} while (myChar != 27); //13 es enter
}