using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace myApp
{
class Program
{
static void Main(string[] args)
{
string[] vowels = new string[]{"A","a","E","e","I","i","O","o","U","u"};
for(int j=0;j<vowels.Length;j++)
{
string[] names = new string[5];
names[0] = "john";
names[1] = "samuel";
names[2] = "kevin";
names[3] = "steve";
names[4] = "martyn";
for (int i = 0; i < names.Length; i++)
{
if(vowels[j]==names[i])
{
}
}
Console.WriteLine("The output is:"+names[i]);
}
Console.ReadLine();
}
}
}
有人能帮我删除给定名称中的元音字母并在控制台中显示它们吗?
if(vowels[j]==names[i])
更改为names[i].Replace(vowels[j], ' ');
- Les