解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); String b = sc.next(); char c[] = s.toCharArray(); for (int i = 0; i < c.length / 2/*交换位置次数*/; i++) { char temp = c[i]; c[i] = c[c.length - 1 - i];//第1位角标为0就是和最后一位角标为数组长度-1-i,此时i为0,交换位置 c[c.length - 1 - i] = temp; for (int j = 0; j < c.length; j++) System.out.print(c[j]); System.out.println(); } System.out.println();//这里要打印一个空行我就是踩这里的坑了 for (int j = 0; j < c.length; j++) System.out.print(c[j]); } }
0.0分
1 人评分
A+B for Input-Output Practice (VII) (C语言代码)浏览:1381 |
C二级辅导-分段函数 (C语言代码)浏览:868 |
简单的a+b (C语言代码)浏览:652 |
2005年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:495 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:439 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1293 |
字符串比较 (C语言代码)答案错误????浏览:597 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:858 |
WU-复数求和 (C++代码)浏览:2015 |
三角形 (C语言代码)浏览:914 |