- <div class="blockcode"><blockquote>import java.util.*;
- public class xuesheng {
- public static void main(String[] args){
- Scanner in=new Scanner(System.in);
- System.out.println("请输入学生的人数");
- int student=in.nextInt();
- System.out.println("请输入课程数目");
- int classum=in.nextInt();
- String[] classname=new String[classum];
- String[] studentname=new String[student];
- int[][] score=new int[student][classum];
- int[] sum=new int[student];
- for(int i=0;i<classname.length;i++){
- System.out.println("请定义第"+(i+1)+"门课是什么");
- classname[i]=in.next();
- }
- for(int i=0;i<studentname.length;i++){
- int S=0;
- System.out.println("请输入第"+(i+1)+"学生的名字");
- studentname[i]=in.next();
- for(int j=0;j<classname.length;j++){
- System.out.println("请输入"+studentname[i]+classname[j]+"的成绩");
- score[i][j]=in.nextInt();
- S+=score[i][j];
- }
- sum[i]=S;
- }
- System.out.print("学生"+"\t");
- for(int i=0;i<classname.length;i++){
- System.out.print(classname[i]+"\t");
- }
- System.out.print("总分"+"\t");
- System.out.print("平均分"+"\t");
-
- for(int i=0;i<student;i++){
- System.out.print(studentname[i]);
- for(int j=0;j<classum;j++){
- System.out.print("\t"+score[i][j]);
- }
- System.out.print("\t"+sum[i]);
- System.out.println("\t"+sum[i]/classum);
- }
-
-
- }
- }
复制代码 为什么在Eclipse会出现在dos中就没有呢
|
|