using System;using System.Collections.Generic;using System.Text;namespace projGetMaxScore{? ? class Program? ? {? ? ? ? static void Main(string[] args)? ? ? ? {? ? ? ? ? ? ?int j,max;? ? ? ? ? ? ?max = j = -1;? ? ? ? int[] score=new int[8]{89,90,98,56,60,91,93,85};? ? ? ? ? ? string[] name=new string[8]{"吳松","鐵東寧","伏晨","陳陸","周蕊","林日鵬","何昆","關欣"};//申明姓名數組? ? ? ? for (int i = 0; i < 8;i++ )? ? ? ? {? ? ? ? ? ? if (max < score[i])? ? ? ? ? ? {? ? ? ? ? ? ? ? j++;? ? ? ? ? ? ? ? max = score[i];? ? ? ? ? ? }? ? ? ? }? ? ? ? Console.Write("分數最高的是{0},分數是{1},",name[j],max);? ? ? ? ? ??? ? ? ? }? ? }}
1 回答
已采納

慕婉清0_郁亂我心
TA貢獻22條經驗 獲得超43個贊
"=" 是 賦值符號,而不是 數學中 ?相等的意思?,
max = j = -1 ?:
????????????????????????將 -1 的值 先賦值給 j,這是 j 的 對應的 值為 -1
?????????????????????然后再將 j 的值 賦值給 max,這是 max 的值 為 變量 j 所對應的 值 -1????
????????????????????由于 max,j 都是 int 類型 的 變量 所以 max = j = -1? 是沒有問題的
- 1 回答
- 0 關注
- 1674 瀏覽
添加回答
舉報
0/150
提交
取消