string s1 = ""; Console.Write("请输入一个字符串:"); s1 = Console.ReadLine(); for (int i = 0; i < s1.Length; i++) { if ((int)s1[i] >= 97 && (int)s1[i] <= 119) { int b = (int)s1[i] + 3; Console.Write(" "+(char)b); } else if((int)s1[i] >=120 && (int)s1[i]<=122) { int b = (int)s1[i] - 23; Console.Write(" "+(char)b); } else if((int)s1[i] >= 65 && (int)s1[i]<=87) { int b = (int)s1[i] + 3; Console.Write(" " + (char)b); } else if ((int)s1[i] >= 88 && (int)s1[i] <= 90) { int b = (int)s1[i] - 23; Console.Write(" " + (char)b); }
对输入的字符进行转化