怎么運(yùn)行失敗呀
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string job = "科員";
? ? ? ? ? ? if (job == "局長")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發(fā)雙黃月餅");
? ? ? ? ? ? }
? ? ? ? ? ? else if (job == "處長")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發(fā)蛋黃月餅");
? ? ? ? ? ? }
? ? ? ? ? ?else if(job=='科長') //請輸入
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發(fā)棗泥月餅");
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? ? ?else//請輸入
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發(fā)五仁月餅");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
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("發(fā)雙黃月餅");
? ? ? ? ? ? }
? ? ? ? ? ? else if (job == "處長")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發(fā)蛋黃月餅");
? ? ? ? ? ? }
? ? ? ? ? ? else if (job == "科員")//請輸入
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發(fā)棗泥月餅");
? ? ? ? ? ? }
? ? ? ? ? ? else//請輸入
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("發(fā)五仁月餅");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2017-11-24
注意else if(job=='科長') 這里因該用字符串類型而不是字符型因?yàn)檩斎氲臐h字?jǐn)?shù)目已經(jīng)超過了一個(gè)人
2017-09-18
?else if(job=='科長') //請輸入?
?else if(job=="科長") 你的符號打錯(cuò)了是“”不是''