本帖最后由 ↖落葉下♀媃媚 于 2013-4-7 10:58 编辑
string[] lines = text成绩.Lines;
string maxname = "";
int maxscore = 0;
foreach(string line in lines)
{
string[] str = line.Split('=');
string name = str[0];
string strscore = str[1];
int score = Convert.ToInt32(strscore);
if(score>maxscore)
{
maxscore = score;
maxname = name;
}
}
MessageBox.Show(string.Format("{0}是第一名,成绩为{1}", maxname, maxscore));
foreach(string line in lines)这句什么意思?
|