usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Collections;namespaceconsoleapplication3{classProgram {structStudent { Public stringSno; Public stringname; Public Doublescore; } Static voidMain (string[] args) { //1. Loop to add student informationArrayList Al =NewArrayList (); for(inti =1; I <=3; i++) {Student St=Newstudent (); Console.Write ("Please enter student number:"); St.sno=Console.ReadLine (); Console.Write ("Please enter student's name:"); St.name=Console.ReadLine (); Console.Write ("Please enter student score:"); St.score=Double. Parse (Console.ReadLine ()); Al. ADD (ST); Console.WriteLine ("-------------------------"); } //PrintConsole.WriteLine ("Print according to the score table"); foreach(ObjectOinchal) {Student x=(student) O; Console.WriteLine (X.sno+"\ t"+x.name+"\ t"+X.score); } //2. Sorting for(inti =0; I < al. count;i++ ) { for(intj = i +1; J < al. count;j++) {Student a=(student) al[i]; Student B=(student) al[j]; if(a.score<b.score) {Objectzhong=Al[i]; Al[i]=Al[j]; AL[J]=Zhong; } } } //3. PrintingConsole.WriteLine ("=================================================="); Console.WriteLine ("rank from big to small in score"); foreach(ObjectObinchal) {Student O=(student) OB; Console.WriteLine (O.sno+"\ t"+o.name+"\ t"+O.score); } console.readline (); } }}
C # Use structure, enter 5 person's number, name, score, according to the high and low ranked print out