I'm trying to perform a URI exercise, and in 1 part it asks for the following:
In the first pass, only characters that are lowercase and capital letters should be moved 3 positions to the right, according to ASCII table: letter 'a' should turn letter 'd', letter 'y' should turn character '|' and so on
But he is also changing those that do not leave lowercase and uppercase letters, I do not know why this is happening, thank you who can help.
For example:
with input texto #3
should exit wh{wr #3
, however leaving wh{wr <
#include <stdio.h>
#include <string.h>
int main(){
char x[10],y[10];
int i,qnt;
fgets(x,sizeof(x),stdin);
qnt = strlen(x);
/******** 1 PASSADA ************/
for(i = 0;i<qnt;i++){
if (((x[i]>=65) && (x[i]<=90)) || ((x[i]>=97) && (x[i]<=122)) )
y[i]=x[i]+3;
printf("%d %d , %c \n",i,y[i],y[i]);
}
printf("tamanho da string %i \n",qnt);
printf("normal %d , %s\n",x,x);
printf("1 passada , %s \n",y);
printf("normal %d , %s\n",x,x);
for(i = 0;i<qnt;i++){
printf("%d %d , %c \n",i,x[i],x[i]);
}
}