Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 8, 2021 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/8d7b3bf819bf283d62045d6fe9632b28 to your computer and use it in GitHub Desktop.
Save parzibyte/8d7b3bf819bf283d62045d6fe9632b28 to your computer and use it in GitHub Desktop.
void codifica(char texto[MAXIMA_LONGITUD_CADENA], char matriz[LONGITUD][LONGITUD])
{
int longitud = longitudCadena(texto);
int x = 0;
while (x < longitud)
{
char primera = texto[x];
if (x + 1 < longitud)
{
char segunda = texto[x + 1];
if (primera != ' ' && segunda != ' ' && primera != codigoGlobal && segunda != codigoGlobal)
{
char nuevaPrimera = remplazoPrimera(matriz, primera, segunda);
char nuevaSegunda = remplazoSegunda(matriz, primera, segunda);
texto[x] = nuevaPrimera;
texto[x + 1] = nuevaSegunda;
x++;
}
}
x++;
}
}
void decodifica(char texto[MAXIMA_LONGITUD_CADENA], char matriz[LONGITUD][LONGITUD])
{
// Se usa la misma función
codifica(texto, matriz);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment