题目描述
大家c语言的学的第一个程序应该就是输出hello world,我们知道每一个字符都有一个ASCII码,比如输出
hello world每一个字符的ASCII码+1对应的那个字符.比如a对应ASCII码的下一个字符是b.
输入描述:
hello world
输出描述:
ifmmp!xpsme
参考代码:
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();//这里如果是sc.next();就读不进空格了
for(int i=0;i<str.length();i++) {
System.out.print((char)(str.charAt(i)+1));
}
}
}