C# 通讯录管理系统 控制台
C# 通讯录管理系统 控制台
自学C#一段时间了,看到这篇文章 C#通讯录管理系统,按文中课题要求自己捣鼓了一个练手,欢迎大侠指导
功能要求
- 建立通讯录
- 插入记录
- 查询记录
- 删除记录
- 显示所有记录
代码
using System;
using System.Collections.Generic;
namespace StudentsBook
{
class Program
{
private const string _welcome = @"
********** ^@^ 欢迎使用学生管理系统 **********
* 1 建通讯录 *
* 2 插入记录 *
* 3 查询记录 *
* 4 删除记录 *
* 5 显示信息 *
* 0 退出系统 *
********** ^@^ 欢迎使用学生管理系统 **********";
// 存通讯录用的List
private static List<Student> _books;
//俩dic用于查找
private static Dictionary<string, Student> _hashmapByID;
private static Dictionary<string, List<Student>> _hashmapByName;
private static int c = 0; //序号
static void Main(string[] args)
{
_books = new List<Student>();
_hashmapByID = new Dictionary<string, Student>();
_hashmapByName = new Dictionary<string, List<Student>>();
Console.WriteLine(_welcome);
while (true)
{
Console.Write("请选择功能 0-5: ");
var ct = Console.ReadLine();
switch (ct)
{
case "0":
{
break;
}
case "1":
{
MkBook();
break;
}
case "2":
{
Insert();
break;
}
case "3":
{
Search();
break;
}
case "4":
{
Delete();
break;
}
case "5":
{
Show();
break;
}
default:
{
Console.WriteLine(_welcome);
break;
}
}
if (ct == "0")
{
Console.WriteLine("退出系统");
break;
}
}
}
private static void