怎么運行失敗呀
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string job = "科員";
? ? ? ? ? ? if (job == "局長")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發雙黃月餅");
? ? ? ? ? ? }
? ? ? ? ? ? else if (job == "處長")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發蛋黃月餅");
? ? ? ? ? ? }
? ? ? ? ? ?else if(job=='科長') //請輸入
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發棗泥月餅");
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? ? ?else//請輸入
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發五仁月餅");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2018-05-03
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string job = "科員";
? ? ? ? ? ? if (job == "局長")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發雙黃月餅");
? ? ? ? ? ? }
? ? ? ? ? ? else if (job == "處長")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發蛋黃月餅");
? ? ? ? ? ? }
? ? ? ? ? ? else if (job == "科員")//請輸入
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發棗泥月餅");
? ? ? ? ? ? }
? ? ? ? ? ? else//請輸入
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發五仁月餅");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2017-11-24
注意else if(job=='科長') 這里因該用字符串類型而不是字符型因為輸入的漢字數目已經超過了一個人
2017-09-18
?else if(job=='科長') //請輸入?
?else if(job=="科長") 你的符號打錯了是“”不是''