Using structural body to practise examinee information input

Source: Internet
Author: User

Machine Test topic: 1. Enter information for 3 students: Student number, name, five course results (Chinese, maths, English, Chemistry, physics), the highest score of the minimum score and the average score of the output students, if there is a failure, the output of their subjects and results. 2. Write a program to achieve a Grand Prix site score. A total of 10 judges scored, up to 100 points, minus a maximum score and a minimum score after the average score is the final score. Ask the user to enter the jury name and the score given by the jury, and then indicate which judges scored the highest, the highest score, which judges scored the lowest, the lowest score, and finally removed the highest score and the lowest score to calculate the final average score. 3. Programming as follows: I. Language and environment A, implementation technology: C#B, environmental requirements: MicrosoftVisual Studio 2012. Second, requirements: specific requirements: A. The information of 10 students is recorded from the console with the results (student number, name, C language score) using the structure.

B Print the total and average scores of the class in the console and print the highest and lowest scores of students

C Print the class score book and discharge the rank according to the high and low grade

Code:

Namespace www{class Program {struct Student {public string code;            public string name;        public decimal degree;            } static void Main (string[] args) {Console.Write ("Please enter the number of people:"); int n = Int. Parse (Console.ReadLine ().            ToString ());            Decimal Sumfen = 0, avg = 0, max = 0, min = 0;            Student[]sumstu=new Student[n]; loop input for (int i = 0; i < n; i++) {Console.WriteLine ("Please enter" + (i+1) + "Student                Information ");                Console.WriteLine ("Study number name C language score, TAB key separated");                string s = Console.ReadLine ();                string[] Sarr = s.split (new char[]{' \ t '});//Use Split to separate by delimiter sumstu[i].code=sarr[0];                SUMSTU[I].NAME=SARR[1]; Sumstu[i].degree=decimal.                Parse (sarr[2]);            Sumfen + = Sumstu[i].degree; } Console.WriteLine ("*****************************************************"); Console.WriteLine ("Total Score:" +sumfen.            ToString ());            AVG = sumfen/n; Console.WriteLine ("Mean score:" +avg.            ToString ());                Bubble sort for (int i = 0, i < n-1; i++) {for (int j = i + 1; j < N; j + +) {if (Sumstu[i].degree < Sumstu[j].degree) {Stud                        Ent zhong = new Student ();                        Zhong =sumstu[i];                        Sumstu[i] = Sumstu[j];                    SUMSTU[J] = Zhong; }}} Console.WriteLine ("Highest score:" +sumstu[0].degree.            ToString ()); Console.WriteLine ("Lowest score:" +sumstu[n-1].degree.            ToString ());            Console.WriteLine ("The Class results list is as follows:");            Console.WriteLine ("*************************************************");            Console.WriteLine ("Rank" + "\ T" + "study number" + "\ T" + "name" + "\ T" + "score"); for (int i = 1; I <= n; i++) {               Console.WriteLine (i+ "\ t" +sumstu[i-1].code+ "\ T" +sumstu[i-1].name+ "\ T" +sumstu[i-1].degree);        } console.readline (); }    }}

Use structure to practice examinee information entry

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.