C#趣味题目.
摘要: // 要求算一任意长度字符串中不同的字符以及它的个数。
//c#3.0
/***************第一种方法**********************/
var values = "abcdefgabc"
.GroupBy(c => c)
.Select(g => String.Format("{0}, {1}", g.Key, g.Count()))
.ToArray();
Array.ForEach(values, Console.WriteLine);
/***************第二种方法**********************/
"abcdefgabc"
.GroupBy(c => c).ToList()
.ForEach(g => Console.WriteLine(g.Key + ",
阅读全文
posted @
2009-03-28 00:01 邹江平 阅读(658) |
评论 (2) 编辑
良好的编程习惯,你知道多少呢?你又用过多少呢?<一>
摘要: Good Programming Practice
1,Read the manuals for the version of C++ you are using.
Refer to these manuals frequently to be sure you are aware of the rich collections of C++ features and that you are using them correctly.
2,Your computer and compiler are good teachers.
If after reading your C++ language manuals ,
you still are not sure how a feature of C++ works,
experiment using a small "test program" and see what happens.
Set your complier options for "maximum warnings".
St
阅读全文
posted @
2009-03-02 19:34 邹江平 阅读(941) |
评论 (3) 编辑