Dictionary<int, string> dic = new Dictionary<int, string> { {89,"吴松" },...., { 85,"关欣"}};
Dictionary<int, string> dic1Asc = dic.OrderByDescending(o => o.Key).ToDictionary(o => o.Key, p => p.Value);
Console.WriteLine("分数最高的是{0},分数是{1}",dic1Asc.Values.First(),dic1Asc.Keys.First() );
Dictionary<int, string> dic1Asc = dic.OrderByDescending(o => o.Key).ToDictionary(o => o.Key, p => p.Value);
Console.WriteLine("分数最高的是{0},分数是{1}",dic1Asc.Values.First(),dic1Asc.Keys.First() );
foreach(int i in num)
{
if(i%7!=0)
{}
}
Console.Write("没有7的整倍数");
{
if(i%7!=0)
{}
}
Console.Write("没有7的整倍数");
static void Main(string[] args)
{
int x = 1;
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
if (x%2==1)//筛选条件
sum += x;
x++;
}
Console.Write("1-30奇数的和:"+sum);
}
{
int x = 1;
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
if (x%2==1)//筛选条件
sum += x;
x++;
}
Console.Write("1-30奇数的和:"+sum);
}
2018-03-22
int x=1;
bool a = ++x * x > 3;
bool b =x<3 ;//请赋值
Console.WriteLine(a==b);
bool a = ++x * x > 3;
bool b =x<3 ;//请赋值
Console.WriteLine(a==b);
2018-03-21
Console.WriteLine(true||false);//输出True
Console.WriteLine(true&&false);//输出False
Console.WriteLine(!false);//输出True
Console.WriteLine(true&&false);//输出False
Console.WriteLine(!false);//输出True
2018-03-21
static void Main(string[] args)
{
//声明“职位”数组,初始化为:"经理","项目主管","技术总监","财务主管"
string[] job =new string[4]{"经理","项目主管","技术总监","财务主管"};
for (int i = 0; i < job.Length ; i++)
{
Console.Write(job[i]);//打印职位
}
{
//声明“职位”数组,初始化为:"经理","项目主管","技术总监","财务主管"
string[] job =new string[4]{"经理","项目主管","技术总监","财务主管"};
for (int i = 0; i < job.Length ; i++)
{
Console.Write(job[i]);//打印职位
}
2018-03-20