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
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; }
}
}
Console.Write("分数最高的是");
foreach(var student in hightestScoreStudents)
{
Console.WriteLine("{0},分数是{1}", student.Name, student.Score);
}
}
}
foreach(var student in hightestScoreStudents)
{
Console.WriteLine("{0},分数是{1}", student.Name, student.Score);
}
}
}
public static void TheHightestScoreStudent(List<Student> students)
{
var hightestScoreStudents = from student in students
where student.Score ==students.Max(x => x.Score)
select student;
{
var hightestScoreStudents = from student in students
where student.Score ==students.Max(x => x.Score)
select student;