-
Encyption
the code is suppose to add an ASCII value 1 to every cell of the array of the input from the user.
for example:
user input: ABC
the result should be: DEF
but the problem with my code is that it display the result which is JKL.
Can anyone teach me on this?
here is my code:
void StringEncrypt( char input[]){
for( i=0; i < strlen( input ); i++)
input[i]=input[i]+3;
printf("Result : %s",input);
}
-
This works for me so give it a try:
Code:
#include <stdio.h>
#include <string.h>
int main(void){
char Input[4] = "ABC";
StringEncrypt(Input);
return 0;
}
void StringEncrypt( char input[]){
for(int i=0; i < strlen( input ); i++)
input[i]=input[i]+3;
printf("Result : %s",input);
}
- Sean