幫忙看看哪里錯了,查了很久了?
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("發五仁月餅");
??????????? }
??????? }
??? }
}
2023-05-10
好像是對的,看看運行報錯的地方,可能是標點的中文字符。
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("發五仁月餅"); ????????????} ????????} ????} }我的運行成功了
2022-04-21
沒有聲明數組