标题:编程新手,有个问题解决不了想请大家帮忙解决一下谢谢
取消只看楼主
孟伊铉
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-5-26
结帖率:0
已结贴  问题点数:20 回复次数:0 
编程新手,有个问题解决不了想请大家帮忙解决一下谢谢
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace 实验8
{
    class Program
    {


        static void getCharCount(string b)


   
        {

            SortedList s1 = new SortedList();
            IEnumerator OperandEnum = b.GetEnumerator();
            int CharCount = 0;
            //int m = 0, n;


            while (OperandEnum.MoveNext())
            {
                int m, n;
                CharCount++;
               
                {
                    if (s1.Contains(OperandEnum.Current))
                    {
                        m = s1.IndexOfKey(OperandEnum.Current);
                        n = (int)s1.GetByIndex(m);
                        s1.SetByIndex(m, n + 1);
                    }

                    else
                    {

                        s1.Add(OperandEnum.Current, 1);
                        m = s1.IndexOfKey(OperandEnum.Current);

                    }
                }



                Console.WriteLine("{0}  {1}", s1.GetKey(m), s1.GetByIndex(m));
         





            }
               //Console.WriteLine("{0}  {1}", s1.GetKey(m), s1.GetByIndex(m));

                Console.WriteLine(CharCount);

            }

        
        static void Main(string[] args)
        {
          string   url = @"http//:127.0.0.1:8080/my-apps/chapter1/admin/adduser.jsp";
          getCharCount(url);

           
        }
    }
}
上面是我写的一段代码想得到这样的输出结果在附件中有   
实验八 字符串的操作.rar (1016.69 KB)
,但我输出的结果却不是这样,而是每个字符都输出,请大家帮我解决一下。
搜索更多相关主题的帖子: 问题解决 
2010-05-26 12:12



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-308221-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.158406 second(s), 11 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved