求助!谁能帮我改正这个C#小程序的错误

来源:百度知道 编辑:UC知道 时间:2024/05/06 04:13:33
这是我写的一个C#小程序,运行是发现一个错误.请大家帮忙改正下这个错误,谢谢!
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static int Vowels(string str)
{
int count = 0;
string s;
for (int i = 0; i < str.Length; i++)
{
s = str.Substring(i, 1).ToUpper();
if (s == "A" || s == "E" || s == "O" || s == "U" || s == "T") count++;
}
return count;
}
static int Letters(string str)
{
int count = 0;
foreach (char c in str())
if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') count++;
return count;
}
static int Digitals(str

把()去掉就可以了!

试试看

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static int Vowels(string str)
{
int count = 0;
string s;
for (int i = 0; i < str.Length; i++)
{
s = str.Substring(i, 1).ToUpper();
if (s == "A" || s == "E" || s == "O" || s == "U" || s == "T") count++;
}
return count;
}
static int Letters(string str)
{
int count = 0;
foreach (char c in str)
if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') count++;
return count;
}
static int Digitals(string str