最赞回答 / 慕粉4364288
y就是指我们定义的变量y的值, +号的作用是连接字符,这里连接了后面双引号里面内容,是一个空格,这样每输出一次y的值也要输出一个空格,这样就把输出的每个数字都隔开了(5 4 3 2 1)不然他们就会连在一起(54321)这样子。
2018-04-21
static void Main(string[] args)
{
int y=5;
while(y<10)
{
y++;
}
while(y>=1)
{
Console.Write(y+" ");
y--;
}
{
int y=5;
while(y<10)
{
y++;
}
while(y>=1)
{
Console.Write(y+" ");
y--;
}
2018-04-21
int x = 5;
int y = 5;
int z = 5;
++x;
Console.Write(x);
Console.Write(++y);
Console.Write(++z);
把x++改成++x,把y++改成++y,就可以了
因为:比如给x赋值,
a = x++;a = x;x = x+1;
a = ++x;x = x+1;a = x;
int y = 5;
int z = 5;
++x;
Console.Write(x);
Console.Write(++y);
Console.Write(++z);
把x++改成++x,把y++改成++y,就可以了
因为:比如给x赋值,
a = x++;a = x;x = x+1;
a = ++x;x = x+1;a = x;
2018-04-20
最赞回答 / L1Rui_
for ( int GJ = 0; GJ <= 20; GJ++) { for ( int MJ = 0; MJ <=33; MJ++) { for (int XJ = 0; XJ <= 300;XJ++ ) if (5 * GJ + 3 * MJ + XJ / 3.0 == 100&&GJ+MJ+XJ=...
2018-04-18
string[,] score = new string[2,8]{{"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"},{"89","90","98","56","60","91","93","85"}};
string x = "0";
int y =0;
for (int i =0; i<8; i++) {
if (int.Parse(x) < int.Parse(score[1,i])) {
x = score[1,i];
y=i;
}
}
Console.Write("分数最高的是{0},分数是{1}", score[0,y],x);
string x = "0";
int y =0;
for (int i =0; i<8; i++) {
if (int.Parse(x) < int.Parse(score[1,i])) {
x = score[1,i];
y=i;
}
}
Console.Write("分数最高的是{0},分数是{1}", score[0,y],x);
public class Student
{
public Student(string name, int score)
{
Name = name;
Score = score;
}
public string Name { get; set; }
public int Score { get; set; }
}
}
{
public Student(string name, int score)
{
Name = name;
Score = score;
}
public string Name { get; set; }
public int Score { get; set; }
}
}