using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
string[] name=new string[]{"关羽","张飞","赵云","马超","黄忠"}
for (int i=0;i<name.Length;i++)
{
Console.Write(name[i]=",");
}
}
}
}
string[] name=new string[]{"关羽","张飞","赵云","马超","黄忠"} 最后少个 ;
直接复制在vs里面去运行,就知道了,我这上面也显示错了。但vs运行出来没问题
应该是 Console.Write(name[i]+","); +是把全部字符从拼接起来,用逗号隔开。
少个空格
string[] name=new string[]{"关羽","张飞","赵云","马超","黄忠"}后面没加;
Console.Write(name[i]=",");应该是 Console.Write(name[i]+",");