while(true) { Double[,] a =New Double[3,4];//defines a two-bit array of three rows and four columns for(inti =0; I <3; i++)//loop out three results for each person{a[i,0] = i +1;//Show School NumberConsole.Write ("Please enter section"+ (i+1)+"individual's language scores:"); A[i,1] = convert.todouble (Console. ReadLine ());//Input language scoresConsole.Write ("Please enter section"+ (i+1)+"Individual Math results:"); A[i,2] = convert.todouble (Console. ReadLine ());//Enter Math scoresA[i,3] = A[i,1] + a[i,2];//figure out the total score} Console.WriteLine ("The end result is:"); Console.WriteLine ("School Number"+"\ t"+"language"+"\ t"+"Mathematics"+"\ t"+"Total"); for(inti =0; I <3; i++)//output Three rows four columns { for(intj =0; J <4; J + +) {Console.Write (A[i,j]+" "); } console.readline (); } }
Example: Use two-dimensional array to calculate the total score, list the score table.