#include <stdio.h>
int main()
{
char line[80];
int count;
// read the line of charecter
printf("Enter the line of text below: \n");
scanf("%[ˆ\n]",line);
// encode each individual charecter and display them
for(count = 0; line[count]!= '\0'; ++ count){
if(((line[count]>='0')&& (line [count]<= '9')) ||
((line[count]>= 'A')&& (line[count]<='Z')) ||
((line[count]>= 'a')&& (line[count]<='z')))
putchar(line[count]+1);
else if (line[count]=='9')putchar('0');
else if (line [count]== 'A')putchar('Z');
else if (line [count]== 'a') putchar('z');
else putchar('.');
}
}
위의 코드에서 문제는 인코딩 변환 중입니다. 코드를 컴파일 할 때마다 컴파일러에서 자동으로 인코딩을 변환 한 다음 필요한 출력을 얻을 수 없습니다. 내 목표 출력과 같아야합니다 모든 편지를 들어아스키 문자 인코딩 문제
enter the string
Hello World 456
Output
Ifmmp.uif.tusjof
,이 2 문자와 공백으로 대체된다 '는 .
'로 대체됩니다.
출력 결과를 "back the string"으로 변환합니다. 그게 네가해야 할 일 이니? – usr2564301
원하는 출력이 "Hello World 456"이 아닌 "Hello Strine"텍스트와 일치하는 것으로 보입니다. –