最赞回答 / 一念征途
{0}占位符,所谓占位符,就像是挤公交抢座,先占好位置,然后再使用真正的值来替换掉它。同时它还有格式化输出的功能。<...图片...><...图片...>其他更详细的资料也百度下,在这就不一一列举了。对于这个(“”+sum),只是单纯的自动转成字符格式,进行字符拼接。 望采纳!
2017-06-19
string[] no = new string[8];
for (int j=0;j< no.Length;j++)
{
if(score[j]>avg)
{
no[j] = name[j];
Console.Write(no[j]+" ");
}
}
//Console.ReadLine();
for (int j=0;j< no.Length;j++)
{
if(score[j]>avg)
{
no[j] = name[j];
Console.Write(no[j]+" ");
}
}
//Console.ReadLine();
string[] name = { "景珍", "林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };
int[] score = { 90, 65, 88, 70, 46, 81, 100, 68 };
int sum = 0;
for (int i = 0; i < score.Length; i++)
{sum += score[i]; }
int avg = sum / score.Length;
Console.WriteLine("平均分是{0},高于平均分的有:", avg);
int[] score = { 90, 65, 88, 70, 46, 81, 100, 68 };
int sum = 0;
for (int i = 0; i < score.Length; i++)
{sum += score[i]; }
int avg = sum / score.Length;
Console.WriteLine("平均分是{0},高于平均分的有:", avg);