c#习题之3

Dictionary<int, char> d = new Dictionary<int, char>();
            int i=0;
            string s = "Welcome to china";
            char[] c = new Char[s.Length];
            foreach (var item in s) {
                d.Add(i, item);
                i++;
            }
            foreach (var n in d.Keys) {
                Console.WriteLine(n);
            }
           
            
            Console.ReadKey();
统计 Welcome to china中每个字符出现的次数 不考虑大小写

 

posted @ 2015-10-27 11:19  尘梦  阅读(184)  评论(0编辑  收藏  举报