string[,] arr = new string[,]{{"吴松","89"},{"钱东宇","90"},{"伏晨","98"},{"陈陆","56"},{"周蕊","60"},{"林日鹏","91"},{"何昆","93"},{"关欣","85"}};
int m = 0;int s;string n=null;
for(int i=0;i<arr.GetLongLength(0);i++)
{s = int.Parse(arr[i,1]);if(m<s){m = s;n = arr[i,0];}}
Console.Write("分数最高的是{0},分数是{1}",n,m);
int m = 0;int s;string n=null;
for(int i=0;i<arr.GetLongLength(0);i++)
{s = int.Parse(arr[i,1]);if(m<s){m = s;n = arr[i,0];}}
Console.Write("分数最高的是{0},分数是{1}",n,m);
Q1:这段程序计算变量d和x的和,并打印。但是d和x的类型不同,计算会出错吗?
A1:会出错,左右精度不同
Q2:那么,程序运行的结果会是多少呢?
A2: 结果为3,2.5的精度到一位小数,(int)2.5相当于将小数部分去掉,所以2+1=3
A1:会出错,左右精度不同
Q2:那么,程序运行的结果会是多少呢?
A2: 结果为3,2.5的精度到一位小数,(int)2.5相当于将小数部分去掉,所以2+1=3
2017-10-26
string[] names = new string[]{"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int[] scores = {89,90,98,56,60,91,93,85};
int max = 0;
string name = "";
for(int i=0;i<scores.Length;i++){
if(scores[i]>max){
max = scores[i];
name = names[i];
}
}
Console.Write("分数最高的是{0},分数是{1}",name, max);
int[] scores = {89,90,98,56,60,91,93,85};
int max = 0;
string name = "";
for(int i=0;i<scores.Length;i++){
if(scores[i]>max){
max = scores[i];
name = names[i];
}
}
Console.Write("分数最高的是{0},分数是{1}",name, max);
最新回答 / qq_郭亮_0
你确定你打开软件是对的??,我今天也是这样,元来是打开软件图标点错了,visual studio 2015这个,不是Blend for visual studio 2015.
2017-10-23
不要相信这道题下面评论说是3的,如果是3,这完全违反了数学原理,这就是你们为何一直提交不到,这才是正确的代码。 double d = 2.5; double x= d + 1; Console.WriteLine(x);
2017-10-23