日期:2014-05-19  浏览次数:21095 次

请问各位大侠……
以下是把程序无法通过编译,请问各位大侠如何解决??


using   System;


class   test
{
        public   static   void   Main(String[]   args)
        {
                if   (args.Length   <   1)
                {
                        Console.WriteLine( "No   arguments ");
                }
                else
                {
                        String   text;
                        for   (int   i   =   0;   i   <   args.Length;   ++i)
                        {
                                text   =   args[i];
                                for   (int   j   =   0;   j   <   text.Length;   ++j)  
                                {
                                        if   (text[j]   > =   'a '   &&   text[j]   <=   'z ')
                                                text[j]   =(char)text[j]-   32;
                                }

                                Console.WriteLine(text);

                        }
                }
        }
}

------解决方案--------------------
using System;

class test
{
public static void Main(String[] args)
{
if (args.Length < 1)
{
Console.WriteLine( "No arguments ");
}
else
{
for (int i = 0; i < args.Length; ++i)
{
string text = args[i];
char[] ch = text.ToCharArray();
for (int j = 0; j < ch.Length; ++j)
{
if (ch[j] > = 'a ' && ch[j] <= 'z ')
ch[j] = (char)((int)ch[j] - 32);
}

Console.WriteLine(ch);
}
}
}
}