c#实现按字符串出现的次数排序(升序)(可以任意输入的句子)控制台实现即可。
最好代码完整点,我刚刚学,是菜鸟级。。谢谢了!!
<或者帮我改改下面的程序 也就是说用下面的方法实现>
(我的代码不完整)using System;namespace 单词的统计与排序
{
public struct word
{
public int count ;
public string key;
}
public class wordTest
{
private word myword;
public word Person(string sName)
{
word s;
s.count=0;
s.key="list";
}
}
class Class1
{
[STAThread]
static void Main(string[] args)
{
string input=Console.ReadLine();
ArrayList d=new ArrayList();
foreach (string s in words)
{
if (s!="")
{
for(int j=0;j<list.count;j++)
{
d=(word)list[j];
if(d.key==s)
{
d.count++;
list[j]=d;
repeat=ture;
break;
}
if(!repeat)
{
return;
}
}
}
}
}
}
}
最好代码完整点,我刚刚学,是菜鸟级。。谢谢了!!
<或者帮我改改下面的程序 也就是说用下面的方法实现>
(我的代码不完整)using System;namespace 单词的统计与排序
{
public struct word
{
public int count ;
public string key;
}
public class wordTest
{
private word myword;
public word Person(string sName)
{
word s;
s.count=0;
s.key="list";
}
}
class Class1
{
[STAThread]
static void Main(string[] args)
{
string input=Console.ReadLine();
ArrayList d=new ArrayList();
foreach (string s in words)
{
if (s!="")
{
for(int j=0;j<list.count;j++)
{
d=(word)list[j];
if(d.key==s)
{
d.count++;
list[j]=d;
repeat=ture;
break;
}
if(!repeat)
{
return;
}
}
}
}
}
}
}
http://topic.csdn.net/u/20071111/19/98629d6c-15a4-4bbd-9a01-5f5bb6f78716.html都是一个学校的吧?