用C#编程:输入一些给定的字符串,统计它们各自出现的次数
3个回答
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,一句话就搞定了
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,一句话就搞定了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
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
用C#编程:输入一些给定的字符串,统计它们各自出现的次数这里有视频教程可以看下 http://www.alisoho.com
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-22
展开全部
LZ你描述清楚点我帮你写
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询