for (int i = 0; i < score.Length; i++)
{
if (score[i] > max)
{
Console.Write(name[i] + " ");
}
}
{
if (score[i] > max)
{
Console.Write(name[i] + " ");
}
}
int sum = 0, avg;
for (int i = 0; i < score.Length; i++)
{
sum += score[i];
}
avg = sum / score.Length;
Console.Write("平均分是{0},", avg);
int max = avg;
Console.WriteLine("高于平均分的有:");
for (int i = 0; i < score.Length; i++)
{
sum += score[i];
}
avg = sum / score.Length;
Console.Write("平均分是{0},", avg);
int max = avg;
Console.WriteLine("高于平均分的有:");
Console.WriteLine(x+" ") 誰解釋一下 。看不懂x+""
打印變量X后再打印一個空格
打印變量X后再打印一個空格
2016-06-03
/*如下寫法有報錯:the name 'age' does not exit in the current context.
int[] age = new int[4];
age[0] = 18;
age[1] = 19;
age[2] = 20;
age[3] = 21;
Console.WriteLine("四位同學的年齡分別是:{0}、{1}、{2}、{3}", age[0], age[1], age[2], age[3]);
int[] age = new int[4];
age[0] = 18;
age[1] = 19;
age[2] = 20;
age[3] = 21;
Console.WriteLine("四位同學的年齡分別是:{0}、{1}、{2}、{3}", age[0], age[1], age[2], age[3]);
2016-06-02
string[] name=new string[] {"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關欣"};
int[] score=new int[] {89,90,98,56,60,91,93,85};
int x=0;
int max=0;
for(int i=0;i<score.Length;i++) {
if(max<score[i]){
max=score[i];
x=i; } }
Console.Write("分數最高的是{0},分數是{1}",name[x],score[x])}}
int[] score=new int[] {89,90,98,56,60,91,93,85};
int x=0;
int max=0;
for(int i=0;i<score.Length;i++) {
if(max<score[i]){
max=score[i];
x=i; } }
Console.Write("分數最高的是{0},分數是{1}",name[x],score[x])}}
static void Main(string[] args)
{
string[] job = { "經理", "項目主管", "技術總監", "財務主管" };
for (int x = 0; x < job.Length; x++)
{
Console.WriteLine(job[x]);
}
}
{
string[] job = { "經理", "項目主管", "技術總監", "財務主管" };
for (int x = 0; x < job.Length; x++)
{
Console.WriteLine(job[x]);
}
}
2016-06-01