????????????Student[]??stuent?=?new?Student[8];
????????????stuent[0]?=?new?Student?{?Name?=?"吳松",Grades?=?89?};
????????????stuent[1]?=?new?Student?{?Name?=?"錢東宇",?Grades?=?90?};
????????????stuent[2]?=?new?Student?{?Name?=?"伏晨",?Grades?=?98?};
????????????stuent[3]?=?new?Student?{?Name?=?"陳陸",?Grades?=?56?};
????????????stuent[4]?=?new?Student?{?Name?=?"周蕊",?Grades?=?60?};
????????????stuent[5]?=?new?Student?{?Name?=?"林日鵬",?Grades?=?91?};
????????????stuent[6]?=?new?Student?{?Name?=?"何昆",?Grades?=?93?};
????????????stuent[7]?=?new?Student?{?Name?=?"關欣",?Grades?=?85?};
????????????Student?temp;
????????????for?(int?i?=?0;?i?<?stuent.Length?-?1?;?i++)
????????????{
????????????????for?(int?j?=?0;?j?<?stuent.Length?-?1?-?i;?j++)
????????????????{
????????????????????if?(stuent[j].Grades?<?stuent[j?+?1].Grades)
????????????????????{
????????????????????????temp?=?stuent[j?+?1];
????????????????????????stuent[j?+?1]?=?stuent[j];
????????????????????????stuent[j]?=?temp;
????????????????????}
????????????????}
????????????????????????
????????????}
????????????/*for?(int?i?=?0;?i?<?8;?i++)
????????????{
????????????????Console.WriteLine($"姓名{stuent[i].Name},分數:{stuent[i].Grades}");
???????????????
????????????}*/
????????????Console.WriteLine($"分數最高的是{stuent[0].Name}");
????????}
????????struct?Student
????????{
????????????private?string?name;
????????????private?int?grades;
????????????public?string?Name?{?get?=>?name;?set?=>?name?=?value;?}
????????????public?int?Grades?{?get?=>?grades;?set?=>?grades?=?value;?}
????????????/*public?override?string?ToString()
????????????{
????????????????
????????????????return?string.Format($"姓名:{this.Name},成績:{this.Grades}");
????????????}*/
????????}
2023-06-28
? ? ? ? ? ? string[] name=new string[8]
? ? ? ? ? ? {"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關欣"};?
? ? ? ? ? ? int[] score =new int[8]{99,90,98,56,60,91,93,85};
? ? ? ? ? ? int max = score[0];
? ? ? ? ? ? int j = 0;
? ? ? ? ? ? for(int i=0;i<score.Length;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if(score[i]>max)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? max=score[i];
? ? ? ? ? ? ? ? ? ? j=i;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ? Console.WriteLine("最高分數的是:{0},分數是:{1}",name[j],max);