//吴松89 钱东宇90 伏晨98 陈陆56 周蕊60 林日鹏91 何昆93 关欣85
//声明两个数组,下标姓名分数相对应
string[] name = new string[] { "吴松", "钱东宇", "伏晨", "陈陆", "周蕊", "林日鹏", "何昆", "关欣" };
int[] score = new int[] { 89,90,98,56,60,81,83,85};
int max = 0;//用来存储最高分
int y = 0; //用来记录下标
//声明两个数组,下标姓名分数相对应
string[] name = new string[] { "吴松", "钱东宇", "伏晨", "陈陆", "周蕊", "林日鹏", "何昆", "关欣" };
int[] score = new int[] { 89,90,98,56,60,81,83,85};
int max = 0;//用来存储最高分
int y = 0; //用来记录下标
string boy = "秀丽";//男孩名字
string girl = "伟强";//女孩名字
string temp;
temp = boy;
//把男孩的名字赋值给temp
boy = girl;
//把女孩的名字赋值给男孩
girl = temp;
//把temp中的名字赋值给女孩
Console.WriteLine("男孩叫"+boy+" 女孩叫"+girl);
string girl = "伟强";//女孩名字
string temp;
temp = boy;
//把男孩的名字赋值给temp
boy = girl;
//把女孩的名字赋值给男孩
girl = temp;
//把temp中的名字赋值给女孩
Console.WriteLine("男孩叫"+boy+" 女孩叫"+girl);
2018-01-13
for (int y = 1; y <= 7; y++)
{
for (int x = 1; x <= 7; x++)
{
Console.Write(x);
if(x==y)
{break;}
}
Console.WriteLine();//换行
}
为什么非要双等号guaobudong搞不懂
{
for (int x = 1; x <= 7; x++)
{
Console.Write(x);
if(x==y)
{break;}
}
Console.WriteLine();//换行
}
为什么非要双等号guaobudong搞不懂
2018-01-13
string[] name = {******};
int[] score = {******};
int sum = 0;
int avg;
foreach (int x in score)
{
sum += x;
}
avg = sum / score.Length;
Console.Write("平均分是{0},高于平均分的有:",avg);//坑爹的全角半角和换行,从头坑到尾...
for (int i = 0; i < score.Length; i++)
{
if (score[i] > avg)
{
Console.Write(name[i]+" ");
}
}
int[] score = {******};
int sum = 0;
int avg;
foreach (int x in score)
{
sum += x;
}
avg = sum / score.Length;
Console.Write("平均分是{0},高于平均分的有:",avg);//坑爹的全角半角和换行,从头坑到尾...
for (int i = 0; i < score.Length; i++)
{
if (score[i] > avg)
{
Console.Write(name[i]+" ");
}
}