Specific requirements: A. The information of any student from the console is recorded with the result (student number, name, C language score) using structure B. Print the total and average scores of the class in the console, and print the highest and lowest student information for the Class C. Print the class score book and discharge the rank according to the high and low grade
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespacejiegouti2{classProgram {structStudent { Public stringXuehao; Public stringxingming; Public decimalFenshu; } Static voidMain (string[] args) {Console.WriteLine ("Welcome to the student score management system! "); Console.WriteLine ("Please enter the number of students"); intShu =int. Parse (Console.ReadLine ()); Student[] Shuzu=NewStudent[shu]; decimalsum =0; for(intm =0; M < Shu; m++) {Console.WriteLine ("Please enter the \ r number, name, C-language score for the {0} students", M +1); stringA =Console.ReadLine (); string[] B = a.split (New Char[] {'\ t' }); Shuzu[m].xuehao= b[0]; Shuzu[m].xingming= b[1]; Shuzu[m].fenshu=decimal. Parse (b[2]); Sum+=Shuzu[m].fenshu; } for(intm =0; M < shu-1; m++) { for(intn = m+1; n < Shu; n++) { if(Shuzu[m].fenshu <Shuzu[n].fenshu) {Student Zhong=Newstudent (); Zhong=Shuzu[n]; Shuzu[n]=Shuzu[m]; SHUZU[M]=Zhong; }}} Console.WriteLine ("Total score is: {0}", sum); Console.WriteLine ("Average score is: {0}", Sum/Shu); Console.WriteLine ("the highest score is {2} of the name {1} of the study number {0}", shuzu[0].xuehao. ToString (), shuzu[0].xingming. ToString (), shuzu[0].fenshu. ToString ()); Console.WriteLine ("the lowest score is the {2} of the name {0} of the study number {1}", Shuzu[shu-1].xuehao. ToString (), Shuzu[shu-1].xingming. ToString (), Shuzu[shu-1].fenshu. ToString ()); Console.WriteLine ("descending order is: \ n rank \ t School number \ t name \ t fraction"); for(intm =0; M < Shu; m++) {Console.WriteLine ((M+1)+"\ t"+shuzu[m].xuehao +"\ t"+ shuzu[m].xingming +"\ t"+Shuzu[m].fenshu); } console.readline (); } }}
The effect is as follows:
15, the structure body exercises