用刚刚学的数组循环写个学生成绩管理
新学的知识有限就先这样吧
import javax.swing.JOptionPane;
public class SPMMG {
public static void main(String[] args) {
int per=Integer.parseInt(JOptionPane.showInputDialog(null,"请输入学生的人数"));
String[]students=new String[per];
int[]resultsa=new int[per];
int courses=Integer.parseInt(JOptionPane.showInputDialog(null,"请输入课程数目"));
String[]course=new String[courses];
for (int i = 0; i < course.length; i++) {
String coursea=JOptionPane.showInputDialog(null,"请输入第"+(i+1)+"门课程名");
course[i]=coursea;
}
for (int i = 0; i < students.length; i++) {
String studentsa=JOptionPane.showInputDialog(null,"请输入第"+(i+1)+"个学生姓名");
students[i]=studentsa;
for (int j = 0; j < course.length; j++) {
int results=Integer.parseInt(JOptionPane.showInputDialog(null,"请输入"+students[i]+" "+course[j]+"的成绩"));
resultsa[i]=results;
}
}
}
}

浙公网安备 33010602011771号