C#重載問題
public void Eatsugar(string sugar,int count){if (sugar == "牛奶糖" && count ==2)Console.WriteLine("牛奶糖不能吃太多哦!");else if (sugar!="牛奶糖"&&count >= 2) ? ? Console.WriteLine("糖不能吃太多了!"); ? ? ? ? ? ?else ? ? ? ? ? ? ? ?Console.WriteLine("吃吧,吃糖糖吧!"); xiaoMing.Eatsugar("牛奶糖 ",2); 我這樣寫為什么總是無法運行第一行的結(jié)果啊/
2016-07-26
?你的兩個實參貌似加了空格,你去掉再試一下
2016-07-26
2016-07-26
能截個圖嗎?在program中