// 第一步聲明兩個數組 分別存儲名字和分數
string[] name = new string[8] { "景珍", "林惠祥", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三明" };
int[] score = new int[8] { 90, 65, 88, 70, 46, 81, 100, 68 };
//第二步 聲明兩個整數值類型與一個非數值類型并初始化值 用來存儲總分 高出平均分同學的名字與對應分數
int vrg = 0;
int a=0;
string c = "";
string[] name = new string[8] { "景珍", "林惠祥", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三明" };
int[] score = new int[8] { 90, 65, 88, 70, 46, 81, 100, 68 };
//第二步 聲明兩個整數值類型與一個非數值類型并初始化值 用來存儲總分 高出平均分同學的名字與對應分數
int vrg = 0;
int a=0;
string c = "";
if (x >= 5)
{
Console.WriteLine("5");
}
else if (y >= 6)
{
Console.WriteLine("6");
}
else
{
Console.WriteLine("7");
{
Console.WriteLine("5");
}
else if (y >= 6)
{
Console.WriteLine("6");
}
else
{
Console.WriteLine("7");
2017-04-26
char[,] ch = { { '我', '是', '軟' }, { '件', '工', '程' }, { '師', '啦', '!' } };
Console.WriteLine("{0}{1}{2}", ch[1, 1], ch[1, 2], ch[2, 0]);
Console.WriteLine("{0}{1}{2}", ch[1, 1], ch[1, 2], ch[2, 0]);
2017-04-25
for (int i = 0; i < score.Length; i++)
{
if (score[i] < 60)//如果有不及格的
{
hasNopass=true//記錄有不及格的
break;
}
}
{
if (score[i] < 60)//如果有不及格的
{
hasNopass=true//記錄有不及格的
break;
}
}
2017-04-25
int[] score = new int[7] { 89, 39, 100, 51, 94, 65, 70 };//分數
Console.Write("不及格的有:");
for (int i = 0; i < score.Length; i++)
{
if (i % 2 != 0)//篩選條件
Console.Write(score[i] + ",");
}
Console.Write("不及格的有:");
for (int i = 0; i < score.Length; i++)
{
if (i % 2 != 0)//篩選條件
Console.Write(score[i] + ",");
}
2017-04-25