string da="獎勵一輛自行車";
string shao="今晚別回家吃飯了!";
int score = 96;//分數
if(score>95)
{//分支1
Console.WriteLine(da);
}
else
Console.WriteLine(shao);
string shao="今晚別回家吃飯了!";
int score = 96;//分數
if(score>95)
{//分支1
Console.WriteLine(da);
}
else
Console.WriteLine(shao);
2016-08-29
string[] t =new string[]{"C","Sh","a","rp"};
//遍歷字符串數組t
foreach(string x in t)
{
Console.Write(x);
}幕兄你可以年薪百萬了
//遍歷字符串數組t
foreach(string x in t)
{
Console.Write(x);
}幕兄你可以年薪百萬了
2016-08-29
static void Main(string[] args)
{
int[] score = { 85,76,98,100,62,60};//分數
bool hasNopass = false;//記錄是否有不及格的,默認沒有
for (int i = 0; i < score.Length; i++)
{
if (score[i] < 60)//如果有不及格的
{
hasNopass=true;//記錄有不及格的
}
}
if (hasNopass==true)
Console.WriteLine("有人不及格");
else
Console.WriteLine("都及格啦!");
}
{
int[] score = { 85,76,98,100,62,60};//分數
bool hasNopass = false;//記錄是否有不及格的,默認沒有
for (int i = 0; i < score.Length; i++)
{
if (score[i] < 60)//如果有不及格的
{
hasNopass=true;//記錄有不及格的
}
}
if (hasNopass==true)
Console.WriteLine("有人不及格");
else
Console.WriteLine("都及格啦!");
}
2016-08-29
static void Main(string[] args)
{
int[] score = new int[] {89,39,100,51,94,65,70 };//分數
Console.Write("不及格的有:");
for (int i = 0; i <score.Length; i++)
{
if(score[i]<60)//篩選條件
Console.Write(score[i]+",");
}
}
{
int[] score = new int[] {89,39,100,51,94,65,70 };//分數
Console.Write("不及格的有:");
for (int i = 0; i <score.Length; i++)
{
if(score[i]<60)//篩選條件
Console.Write(score[i]+",");
}
}
2016-08-29
static void Main(string[] args)
{
//聲明“職位”數組,初始化為:"經理","項目主管","技術總監","財務主管"
string[]job=new string[]{"經理","項目主管","技術總監","財務主管"};
for (int i = 0; i <4; i++)
{
Console.Write(job[i]);//打印職位
}
} 記得換行是個梗
{
//聲明“職位”數組,初始化為:"經理","項目主管","技術總監","財務主管"
string[]job=new string[]{"經理","項目主管","技術總監","財務主管"};
for (int i = 0; i <4; i++)
{
Console.Write(job[i]);//打印職位
}
} 記得換行是個梗
2016-08-29