小弟是个C#初学者,关于C#基础知识大概学习的差不多,比如定义类,接口,数据库连接语法等
最近感觉光看基础知识已经提高不来什么来,想自己做个东西,但又没有具体的构思
麻烦给位好心人能帮帮忙,出个适合我这个层次的小软件题目给为练练手,比如要实现什么功能啊,大致要用到些什么知识这样的设计文档之类的,实在想通过联系来提高自己。
先谢谢给位来!!!!!!!!!!!
最近感觉光看基础知识已经提高不来什么来,想自己做个东西,但又没有具体的构思
麻烦给位好心人能帮帮忙,出个适合我这个层次的小软件题目给为练练手,比如要实现什么功能啊,大致要用到些什么知识这样的设计文档之类的,实在想通过联系来提高自己。
先谢谢给位来!!!!!!!!!!!
求算一任意长度字符串中不同的字符以及它的个数收藏
(1)view plaincopy to clipboardprint?
static void Main(string[] args)
{
string a = "abcdefgabc";
int i = a.Length;
while (i > 0)
{
Console.WriteLine(a[0].ToString() + ":");
a = a.Replace(a[0].ToString(), "");
Console.Write(i - a.Length);
Console.WriteLine();
i = a.Length;
}
}
static void Main(string[] args)
{ string a = "abcdefgabc";
int i = a.Length;
while (i > 0)
{
Console.WriteLine(a[0].ToString() + ":");
a = a.Replace(a[0].ToString(), "");
Console.Write(i - a.Length);
Console.WriteLine();
i = a.Length;
}
} (2)view plaincopy to clipboardprint?
static void Main(string[] args)
{
Console.WriteLine("请输入字符串:");
string str = Console.ReadLine();
CharCount(str);
}
public static void CharCount(string str)
{
if (str == string.Empty) return;
char ch = str.Substring(0).ToCharArray()[0];
int num = str.Split(ch).Length - 1;
Console.WriteLine("char: {0} num: {1}", ch, num);
CharCount(str.Replace(ch.ToString(), ""));
}
static void Main(string[] args)
{
Console.WriteLine("请输入字符串:");
string str = Console.ReadLine();
CharCount(str);
} public static void CharCount(string str)
{
if (str == string.Empty) return;
char ch = str.Substring(0).ToCharArray()[0];
int num = str.Split(ch).Length - 1;
Console.WriteLine("char: {0} num: {1}", ch, num);
CharCount(str.Replace(ch.ToString(), ""));
} (3)view plaincopy to clipboardprint?
static void Main(string[] args)
{
string s = "abcdefgabc";
Dictionary<char, int> list = new Dictionary<char, int>();
for (int i = 0; i < s.Length; i++)
{
if (list.ContainsKey(s[i]))
{
list[s[i]]++;
}
else
{
list.Add(s[i], 1);
}
}
foreach (char key in list.Keys)
{
Console.WriteLine("{0}:{1}", key, list[key]);
}
}
static DataColumn column = new DataColumn();
static DataTable table = new DataTable();
static DataRow MyRow;
ublic static DataTable GetCategoryTree(WebInfoBase info)
{
DataTable dt = info.List(_DefaultDB, "", "[ID],[Title],[ParentID],[ChildNum],[Depth],[OrderNo]", "&version=", "[ID] ASC");
if (table.Rows.Count > 0)
{
table.Columns.Clear();
table.Rows.Clear();
}
CreateDataTable();
GetTree(dt, "0", 0);
return table;
}
public static void GetTree(DataTable dt, string pid, int blank)
{
string str = " ";
DataView dv = new DataView(dt);
dv.RowFilter = "ParentID = " + pid;
if (blank > 0)
{
string s = "";
if (blank == 1)
{
str = "├";
}
for (int i = 2; i <= blank; i++)
{
s = s + " | "+" "+" - ";
}
str = s + "├";
}
foreach (DataRowView drv in dv)
{
string id = drv["ID"].ToString();
string Title = drv["Title"].ToString();
string OrderNo = drv["OrderNo"].ToString();
string ParentID = drv["ParentID"].ToString();
string Depth = drv["Depth"].ToString();
string ChildNum = drv["ChildNum"].ToString();
MyRow = table.NewRow();
MyRow["ID"] = int.Parse(id);
MyRow["Title"] = str + Title;
MyRow["OrderNo"] = int.Parse(OrderNo);
MyRow["ParentID"] = int.Parse(ParentID);
MyRow["Depth"] = int.Parse(Depth);
MyRow["ChildNum"] = int.Parse(ChildNum);
table.Rows.Add(MyRow);
int n = int.Parse(Depth);
//if (n <= 1)
//{
n++;
//}
GetTree(dt, id, n);
}
}
public static void CreateDataTable()
{
table.Columns.Clear();
column = new DataColumn();
column.DataType = System.Type.GetType("System.Int32");
column.ColumnName = "ID";
table.Columns.Add(column);
column = new DataColumn();
column.DataType = System.Type.GetType("System.Int32");
column.ColumnName = "ParentID";
table.Columns.Add(column);
column = new DataColumn();
column.DataType = Type.GetType("System.String");
column.ColumnName = "Title";
table.Columns.Add(column);
column = new DataColumn();
column.DataType = Type.GetType("System.Int32");
column.ColumnName = "ChildNum";
table.Columns.Add(column);
column = new DataColumn();
column.DataType = Type.GetType("System.Int32");
column.ColumnName = "Depth";
table.Columns.Add(column);
column = new DataColumn();
column.DataType = Type.GetType("System.Int32");
column.ColumnName = "OrderNo";
table.Columns.Add(column);
//table.Columns.Clear();
}
要求:可以多用户切换,使用access数据库。就这么多了。