string[] names = new string[]{"武松","钱冬雨","伏晨","陈陆","周聪","林日鹏","何坤","关欣"};
int[] score = new int[]{89,90,98,56,60,91,93,85};
int max;max = score[0];int index = 0;
for (int i=1; i<score.Length; i++){if(score[i] > max){max = score[i];index = i;}}
Console.WriteLine("分数最高的是"+names[index]+",分数是"+max);中文逗号
int[] score = new int[]{89,90,98,56,60,91,93,85};
int max;max = score[0];int index = 0;
for (int i=1; i<score.Length; i++){if(score[i] > max){max = score[i];index = i;}}
Console.WriteLine("分数最高的是"+names[index]+",分数是"+max);中文逗号
string[] job = new string[4]{"经理","项目主管","技术总监","财务主管"};
for (int i = 0; i < 4 ; i++)
{
Console.Write(job[i]);//打印职位
}
你给写好的换行,但是你任务里没有要求到底换行还是不换行,结果答案是不换行,这个错怎么找!
for (int i = 0; i < 4 ; i++)
{
Console.Write(job[i]);//打印职位
}
你给写好的换行,但是你任务里没有要求到底换行还是不换行,结果答案是不换行,这个错怎么找!
2017-12-19
int[] age = new int[4];//声明并初始化长度为4的整形数组
//为数组元素赋值
age[0] = 18;
age[1] = 20;
age[2] = 23;
age[3] = 17;
Console.WriteLine("四名同学的年龄是:{0}、{1}、{2}、{3}",
age[0],age[1],age[2],age[3]);
//为数组元素赋值
age[0] = 18;
age[1] = 20;
age[2] = 23;
age[3] = 17;
Console.WriteLine("四名同学的年龄是:{0}、{1}、{2}、{3}",
age[0],age[1],age[2],age[3]);
2017-12-19
for (int y = 1; y <= 7; y++)
{
for (int x = 1; x <= 7; x++)
{
if(x <= y){
Console.Write(x);
}
}
Console.WriteLine();//换行
}
{
for (int x = 1; x <= 7; x++)
{
if(x <= y){
Console.Write(x);
}
}
Console.WriteLine();//换行
}
2017-12-19
switch (job)
{
case"局长": Console.Write("发双黄月饼"); break;
case"处长": Console.Write("发蛋黄月饼"); break;
case"科长": Console.Write("发枣泥月饼"); break;
default: Console.Write("发五仁月饼"); break;
}
{
case"局长": Console.Write("发双黄月饼"); break;
case"处长": Console.Write("发蛋黄月饼"); break;
case"科长": Console.Write("发枣泥月饼"); break;
default: Console.Write("发五仁月饼"); break;
}
2017-12-19
switch (job)
{
case"局长": Console.Write("发双黄月饼"); break;
case"处长": Console.Write("发蛋黄月饼"); break;
case"科长": Console.Write("发枣泥月饼"); break;
case"其他": Console.Write("发五仁月饼"); break;
}
{
case"局长": Console.Write("发双黄月饼"); break;
case"处长": Console.Write("发蛋黄月饼"); break;
case"科长": Console.Write("发枣泥月饼"); break;
case"其他": Console.Write("发五仁月饼"); break;
}
2017-12-19
第三段
for (int y = 0; y < Stu_names.Length; y++)
{
if (Stu_score[y] > Average)
{
names = Stu_names[y];
}
Console.WriteLine("平均分是{0},高于平均分的有:{1}", Average, names);
}
for (int y = 0; y < Stu_names.Length; y++)
{
if (Stu_score[y] > Average)
{
names = Stu_names[y];
}
Console.WriteLine("平均分是{0},高于平均分的有:{1}", Average, names);
}
2017-12-18
第二段
for (int i=0;i<Stu_score.Length;i++)
{
//获取平均分
x=Stu_score[i];
sum+=x;
x++;
Average=sum/Stu_score.Length;
}
for (int i=0;i<Stu_score.Length;i++)
{
//获取平均分
x=Stu_score[i];
sum+=x;
x++;
Average=sum/Stu_score.Length;
}
2017-12-18
第一段:static void Main(string[] args)
{ string[] Stu_names = new string[] { "景珍", "林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };
int [] Stu_score=new int [] {90,65,88,70,46,81,100,68};
int x=0;
int Average=0;
int sum=0;
string names = "";
{ string[] Stu_names = new string[] { "景珍", "林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };
int [] Stu_score=new int [] {90,65,88,70,46,81,100,68};
int x=0;
int Average=0;
int sum=0;
string names = "";
2017-12-18