int x=1;
bool a = ++x * x > 3;
bool b = ++x * x > 3;//请赋值
Console.WriteLine(a==b);
bool a = ++x * x > 3;
bool b = ++x * x > 3;//请赋值
Console.WriteLine(a==b);
2017-06-30
string[] students = new string[] { ...... }; int[] scores = new int[] { ..... }; int j=0;int max = scores[0]; for (int i = 0; i < scores.Length; i++) { if (scores[i] > max) { max = scores[i]; j = i;} }Console.WriteLine("分数最高的是" + students[j] + ",分数是" + scores[j]); }
参照了问答区大神的思路,可以运行。位置不够,代码亚索咯
参照了问答区大神的思路,可以运行。位置不够,代码亚索咯
每个case后面加上{},就对了
switch (job)
{
case "局长":{ Console.Write("发双黄月饼"); break;}
case "处长":{ Console.Write("发蛋黄月饼"); break;}
case "科长": {Console.Write("发枣泥月饼");break;}
default : {Console.Write("发五仁月饼"); break;}
}
switch (job)
{
case "局长":{ Console.Write("发双黄月饼"); break;}
case "处长":{ Console.Write("发蛋黄月饼"); break;}
case "科长": {Console.Write("发枣泥月饼");break;}
default : {Console.Write("发五仁月饼"); break;}
}
2017-06-28
for (int y = 1; y <= 7; y++)
{
for (int x = 1; x <= 7; x++)
{
Console.Write(x);
}
Console.WriteLine();//换行
if(x==y)
continue;
}
{
for (int x = 1; x <= 7; x++)
{
Console.Write(x);
}
Console.WriteLine();//换行
if(x==y)
continue;
}
2017-06-28