請(qǐng)問(wèn)我這里哪里錯(cuò)了?
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] t =new? string[]{"C","Sh","a","rp"};
? ? ? ? ? ? //遍歷字符串?dāng)?shù)組t
? ? ? ? ? ? foreach(string t in new)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2022-09-09
?你的迭代變量是t, 輸出的是x
2020-07-01
in的右邊是數(shù)組名? ? 數(shù)組名是t? 不是new? ? ? ?
in的左邊是變量? ? 用來(lái)輸出
然后他下面已經(jīng)給了輸出的變量名是x
所以應(yīng)該是foreach(string x in t)
2020-04-28
? foreach(string x in t)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? }