Example: In the phrase naruto
, the letter n
of the frase
vector is in the frase[0]
position.
I want to put it in mat_cript
position [0][0]
.
Not just her, the rest of the sentence too.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>
#include <time.h>
int main()
{
char frase[25];
char mat_cript[i][j];
int chave, tamanho_frase, cont,i,j;
system("cls");
printf("Digite a frase a ser criptografada : ");
gets(frase);
while(chave<1 || chave>25)
{
printf("Digite a chave a ser utilizada (<= 25) : ");
scanf("%d",&chave);
fflush(stdin);
}
tamanho_frase = strlen(frase);
for(cont=0;cont<tamanho_frase;cont++)
frase[cont] = frase[cont]+chave;
printf("\n\nFRASE CRIPTOGRAFADA : %s",frase);
getchar();
for(i=0;i < tamanho_frase;i++){
for(j=0;j< tamanho_frase;j++){
mat_cript[i][j]=frase[i];
}
}
for(i=0;i < tamanho_frase;i++){
for(j=0;j< tamanho_frase;j++){
printf(" %d°elemento da linha %d, coluna %d: %s",j+1;i+1;j+1;mat_cript[i][j]);
}
}
}