1、 用C#编程计算1!+2!+3!+...+10!的结果。
2、 用C#编程由用户输入一个字符串,统计该字符串中数字、字母和其他字符出现的个数。
3、 输入10个数,使它们从小到大排列。
希望各位大侠能够把源程序发来看一下。

解决方案 »

  1.   

    第一个            int x = 10;
                int Result = 0;
                for (int count = 0; count < x; count++)
                {
                    Result = Result + count;
                }
                MessageBox.Show(Result.ToString());
      

  2.   

    第二个:        public static Hashtable CharSameCount(string Str)
            {
                char[] TempArray = Str.ToCharArray();
                ArrayList nStr = new ArrayList();
                for (int i = 0; i < TempArray.Length; i++)
                {
                    if (!nStr.Contains(TempArray[i]))
                    {
                        nStr.Add(TempArray[i]);
                    }
                }
                char[] newStr = (char[])nStr.ToArray(typeof(char));            Hashtable ht = new Hashtable();
                for (int count = 0; count < newStr.Length; count++)
                {
                    string tempStr = Str.Replace(newStr[count].ToString(), "");//在此进行字符串字符替换为空
                    ht.Add(newStr[count], Str.Length - tempStr.Length);//原长度减替换后的长度
                    Str = tempStr;
                }
                return ht;//返回字符串中每个字符个数的哈希表。
            }方法调用: string x = "bacea";
                foreach (DictionaryEntry a in CharSameCount(x))
                {
                    MessageBox.Show("字符:"+a.Key.ToString()+"  数量:"+a.Value.ToString());
                }
      

  3.   

    第三个:            int[] x = { 10,15,30,26,24,87,59,65,4,56,21 };
                Array.Sort(x);//升序(从小到大)
                Array.Reverse(x);//降序(从大到小)
      

  4.   

    int x = 10;
    int Result = 0;
    for (int i= 0; i< x; i++)
     {
        result = result * i;
     }private string GetResult(string str)
    {
     int len=str.Length;
     str=Regex.Replace(str,"[a-zA-Z]","");
     string result=(len-str.Length)+"个字母 ";
     len=str.Length;
     str=Regex.Replace(str,"[0-9]","");
     result+=(len-str.Length)+"个数字 ";
    return result;
    }List<int> lst=new List<int>();
    for(int i=0;i<=10;i++)
    {
     lst.Add(i);
    }
    lst.Sort();