Enter each student's learning score, sorted by total score
struct Student
{
public string name;
public int age;
public double Cshap;
public double Database;
public double Html;
public double sum;
}
static void Main (string[] args)
{
Console.WriteLine ("Please enter the number of students:"); intA =Convert.ToInt32 (Console.ReadLine ()); List<Student> list =NewList<student>(); for(inti =0; i < A; i++) {Student s=NewStudent (); Console.WriteLine ("Please enter the name of the student {0}:", i+1); S.name=Console.ReadLine (); Console.WriteLine ("Please enter the age of the {0} students:", i +1); S.age=Convert.ToInt32 (Console.ReadLine ()); Console.WriteLine ("Please enter the CSHAP score for the {0} students:", i +1); S.cshap=convert.todouble (Console.ReadLine ()); Console.WriteLine ("Please enter the database score for the {0} students:", i +1); S.database=convert.todouble (Console.ReadLine ()); Console.WriteLine ("Please enter the page scores for the {0} students:", i +1); S.html=convert.todouble (Console.ReadLine ()); S.sum= S.cshap + S.database +s.html; List. ADD (s); } //Sort for(inti =0; I < list. count-1; i++) { for(intj =0; J < list. Count-1I J + +) { if(List[j].sum <= List[j +1].sum) {Student ZJ=List[j]; LIST[J]= List[j +1]; List[j+1] =ZJ; } } } //OutputConsole.WriteLine ("name \ t age \tcshap\t database \ t page \ Total score"); foreach(Student datainchlist) {Console.WriteLine (Data.name+"\ t"+data.age+"\ t"+data. cshap+"\ t"+data. Database+"\ t"+data. html+"\ t"+data.sum); }
}
15-07-10 structure-Enter student scores to sort