您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

把字符串abcdef旋转2位得到字符串cdefab

2024/6/16 4:45:50发布13次查看
public class rightshift { public static void main(string args[]) { char[] c = { 'a', 'b', 'c', 'd', 'e' }; for (int i = 0; i c.length; i) { system.out.print(c[i]); } for (int i = 0; i 2; i) { char temp = c[0]; for (int j = 0; j c.length -
public class rightshift {
 public static void main(string args[]) {
  char[] c = { 'a', 'b', 'c', 'd', 'e' };
  for (int i = 0; i    system.out.print(c[i]);
  }
  for (int i = 0; i    char temp = c[0];
   for (int j = 0; j     c[j] = c[j + 1];
   }
   c[c.length - 1] = temp;
  }
  system.out.println();
  for (int i = 0; i    system.out.print(c[i]);
  }
 }
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product