I'm facing problems with my C algorythm that cypher a word with this function using Dev-C++.
Here is my code:
void cifrar(){
int tamanhoTexto, novoASCI, caracToASCI;
char text[129], novoTexto[129], novaLetra;
system("cls");
printf("Digite a palavra a ser cifrada: ");
gets(text); // This is not interpreted by DevC++
tamanhoTexto = strlen(text);
for(int i = 0; i < tamanhoTexto; i++){
caracToASCI = text[i];
novoASCI = decimal_octal(caracToASCI) + tamanhoTexto + i;
novaLetra = novoASCI;
novoTexto[i] = novaLetra;
}
printf("\nCifrado: %s", novoTexto);
getch();
}
When I run it, the program pass the for() and set the novoTexto[] with random characters.
Thanks.