用C#编程:输入一些给定的字符串,统计它们各自出现的次数

如题所述

第1个回答  2013-09-22
using System;using System.Collections.Generic;using System.Linq;using System.Text;
namespace ConsoleApplication1{ class Program { static void Main(string[] args) { List<String> record = new List<String>() { "Hello","World","This","is","my","first","try","to","say","Hello" };
var query = from r in record group r by r.ToLower() into g select new { Count = g.Count(), Value = g.Key };
foreach (var v in query) { Console.WriteLine("Value = {0}, Count = {1}", v.Value, v.Count); } } }}使用LINQ TO OBJECT,一句话就搞定了
第2个回答  2013-09-22
附上程序#include <iostream>#include <cstdlib>using namespace std;int main(void)unsigned NumDigit(unsigned n);//我相信这个整数不会超过255位吧 unsigned res = 0; itoa(n, c, 10); for (int i = 0; c[i] != NULL; ++i) res++; return res;}
用C#编程:输入一些给定的字符串,统计它们各自出现的次数这里有视频教程可以看下 http://www.alisoho.com
第3个回答  2013-09-22
LZ你描述清楚点我帮你写
相似回答