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]+" ");
}
}
string[] name = {"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int[] score = {89,90,98,56,60,91,93,85};
for (int i = 100; i >= 0; i--)
{
for (int x = 0; x < score.Length; x++)
{
if (score[x] == i)
{
Console.Write("分数最高的是{0},分数是{1}",name[x],score[x]);
return;
}
}
}
int[] score = {89,90,98,56,60,91,93,85};
for (int i = 100; i >= 0; i--)
{
for (int x = 0; x < score.Length; x++)
{
if (score[x] == i)
{
Console.Write("分数最高的是{0},分数是{1}",name[x],score[x]);
return;
}
}
}
for (int i = 5;i <= 5&&i>=1 ;i-- )//请填写代码
{
Console.WriteLine(i+" ");
}
{
Console.WriteLine(i+" ");
}
2018-01-11
int z = 7;
for (int y = 1; y <= 7; y++)
{
for (int x = 1; x <= 7; x++)
{
if (y == x || z == x)
{
Console.Write("o");
}
else
{
Console.Write(".");
}
}
Console.WriteLine("");
z--;
}
for (int y = 1; y <= 7; y++)
{
for (int x = 1; x <= 7; x++)
{
if (y == x || z == x)
{
Console.Write("o");
}
else
{
Console.Write(".");
}
}
Console.WriteLine("");
z--;
}
static void Main(string[] args)
{
int x;
for (int i = 1; i < 13; i++)
{
x = i + 0;
Console.Write("{0}\n", x);
}
{
int x;
for (int i = 1; i < 13; i++)
{
x = i + 0;
Console.Write("{0}\n", x);
}
2018-01-11