亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么我運行出錯

這是代碼

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication9
{
??? class Program
??? {
??????? static void Main(string[] args)
??????? {
??????????? string name;
??????????? Console.Write("請輸入您的姓名:");
??????????? name = Console.ReadLine();
??????????? Console.WriteLine("你好,{0]!",name);
??????? }
??? }
}



輸入名字回車后的結果

未經處理的異常:? System.FormatException: 輸入字符串的格式不正確。
?? 在 System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
?? 在 System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
?? 在 System.IO.TextWriter.WriteLine(String format, Object arg0)
?? 在 System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object arg0)
?? 在 System.Console.WriteLine(String format, Object arg0)
?? 在 ConsoleApplication9.Program.Main(String[] args) 位置 e:\新建文件夾\代碼\ConsoleApplication9\ConsoleApplication9\Program.cs:行號 16


正在回答

1 回答

?Console.WriteLine("你好,{0]!",name);應該為? ??Console.WriteLine("你好,{0}!",name)

0 回復 有任何疑惑可以回復我~
#1

Windseek 提問者

非常感謝!
2018-07-22 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么我運行出錯

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號