参考代码:
import java.util.Scanner; public class Main { public static String[] input(){ Scanner sc = new Scanner(System.in); int number = sc.nextInt(); sc.nextLine();//遇到回车才会结束 String[]information = new String[number]; for (int i = 0; i < number; i++) { String s=sc.nextLine(); s=s.replaceAll(" ",",");//将左边的替换成右边的 information[i] = s; } return information; } public static void print(String[] information){//对information的调用 for (int i = 0; i <information.length; i++) { System.out.println(information[i]); } } public static void main(String[] args) { print(input()); } }
0.0分
1 人评分
大神老白 (C语言代码)浏览:645 |
wu-理财计划 (C++代码)浏览:835 |
DNA (C语言描述,数据结构)浏览:855 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:916 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:885 |
C语言程序设计教程(第三版)课后习题9.2 (C语言代码)浏览:556 |
蚂蚁感冒 (C语言代码)浏览:1333 |
母牛的故事 (C语言代码)浏览:944 |
A+B for Input-Output Practice (C语言代码)浏览:468 |
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:645 |