紧急求救...一个简单的项目```
一个图书管理系统`完全C#做的题目要求
4.1 功能划分
功能编号 功能名称 备注
01 图书信息管理 管理图书的基本信息
0101 添加图书信息 添加新书信息
0102 修改图书信息 修改图书信息
0103 查询图书信息 根据条件查询图书信息
4.2 图书信息管理
管理图书的基本信息。
描述图书基本信息如下表
图书名称 必填
作者 必填
出版社 必填
发行编号 必填
4.2.1 添加新书信息
新书采购回来后,必须要将书的基本信息记录下来,方便以后查阅
4.2.2 修改图书信息
修改图书的基本信息。
4.2.3 查询图书信息
查询存在的图书信息
菜单分级
static void Main(string[] args) //主函数
{
zhucaidan();
Console.ReadKey();
}
static void zhucaidan()
{
Console.Clear();
Console.WriteLine("");
Console.WriteLine(" ++++++++++++++++++++欢迎进入图书管理系统++++++++++++++++");
Console.WriteLine("");
panduan:
Console.WriteLine(" * 添加图书信息请按1\n * 修改图书信息请按2\n * 查询图书信息请按3");
string i = Console.ReadLine();
if (i == "1")
{
tianjia();
}
else if (i == "2")
{
xiugai();
}
else if (i == "3")
{
chaxun();
}
else
{
Console.Clear();
Console.WriteLine("请按提示选择");
goto panduan;
}
Console.WriteLine();
}
static void tianjia()//添加
{
Console.Clear();
Console.WriteLine("");
Console.WriteLine(" ++++++++++++++++++++图书添加管理+++++++++++++++++++++");
Console.WriteLine("");
Console.WriteLine(" 请输入所添加的图书信息 若要返回,请按f键");
string i = Console.ReadLine();
if (i == "f")
{
zhucaidan();
}
}
static void xiugai()//修改
{
fanhui:
Console.Clear();
Console.WriteLine("");
Console.WriteLine(" ++++++++++++++++++++图书信息修改+++++++++++++++++++");
Console.WriteLine("");
Console.WriteLine("修改图书作者请按1,修改图书名字请按2,修改图书编号请按3,修改图书出版社请按4");
Console.WriteLine(" 返回主菜单请按f");
string i = Console.ReadLine();
if (i == "1")
{
Console.WriteLine("请选择所需要修改的图书的作者");
Console.WriteLine(" 返回上一级菜单请按f");
string j = Console.ReadLine();
if (j == "f")
{
xiugai();
}
}
else if (i == "2")
{
Console.WriteLine("请选择所需要修改的图书的书名");
Console.WriteLine(" 返回上一级菜单请按f");
string j = Console.ReadLine();
if (j == "f")
{
xiugai();
}
}
else if (i == "3")
{
Console.WriteLine("请选择所需要修改的图书的编号");
Console.WriteLine(" 返回上一级菜单请按f");
string j = Console.ReadLine();
if (j == "f")
{
xiugai();
}
}
else if (i == "4")
{
Console.WriteLine("请选择所需要修改的图书的出版社");
Console.WriteLine(" 返回上一级菜单请按f");
string j = Console.ReadLine();
if (j == "f")
{
xiugai();
}
}
else if (i == "f")
{
zhucaidan();
}
else
{
goto fanhui;
}
}
static void chaxun()//查询
{
Console.Clear();
Console.WriteLine("");
Console.WriteLine(" ++++++++++++++++++++图书信息查询+++++++++++++++++++");
Console.WriteLine("");
Console.WriteLine("请输入查询的条件 返回主菜单请按f");
Console.WriteLine("");
string i = Console.ReadLine();
if (i == "f")
{
zhucaidan();
}
}
这是已经给了的函数:
using System;
using System.Collections.Generic;
using System.Text;
using
namespace test
{
class Program
{
private static FileStream fs_OpenTxt;
static void Main(string[] args)
{
string str = "wewerwe oiiipi poipipi pipipi";
string[] str_Arry = str.Split(new char[] { ' ' });
Console.WriteLine(str);
foreach (string temp in str_Arry)
{
Console.WriteLine(temp);
}
//string[] str_Mystr = ReadTxt("temp.txt");
//InsertTxt("temp.txt", "9967");
//foreach(string temp in str_Mystr)
//{
// Console.WriteLine(temp);
//}
Console.ReadKey();
}
static void OpenTxt(string str_Path)
{
if (File.Exists(str_Path))
{
fs_OpenTxt = new FileStream(str_Path, FileMode.Open);
}
else
{
fs_OpenTxt = new FileStream(str_Path, FileMode.OpenOrCreate);
}
}
static string[] ReadTxt(string str_Path)
{
int int_Count = IOCount(str_Path);
OpenTxt(str_Path);
StreamReader sr_ReadInfo = new StreamReader(fs_OpenTxt);
string[] str_Arry = new string[int_Count];
for (int i = 0; i < int_Count; i++)
{
str_Arry[i] = sr_ReadInfo.ReadLine();
}
fs_OpenTxt.Close();
return str_Arry;
}
static int IOCount(string str_Path)
{
OpenTxt(str_Path);
int int_Count = 0;
using (StreamReader sr_temp = new StreamReader(fs_OpenTxt))
{
string str_Null = "";
while ((str_Null = sr_temp.ReadLine()) != null)
{
int_Count++;
}
}
fs_OpenTxt.Close();
return int_Count;
}
static void InsertTxt(string str_Path,string str_InsetTxt)
{
string[] str_Temp = ReadTxt(str_Path);
File.Delete(str_Path);
OpenTxt(str_Path);
using (StreamWriter sw_InsertTxt = new StreamWriter(fs_OpenTxt))
{
for (int i = 0; i < str_Temp.Length; i++)
{
sw_InsertTxt.WriteLine(str_Temp[i]);
}
sw_InsertTxt.WriteLine(str_InsetTxt);
}
fs_OpenTxt.Close();
}
}
}
我单独先做出来的查询:
class Program
{
struct book
{
public string mingcheng;
public string zuozhe;
public string chubanshe;
public string bianhao;
}
static void Main(string[] args) //主函数
{
book[] bo_Arry = new book[5];
bo_Arry = shu();
chaxun(bo_Arry);
Console.ReadKey();
}
static book[] shu()
{
book[] bo_Arry = new book[5];
for (int i = 0; i < 5;i++ )
{
bo_Arry[0].mingcheng = "梦里花落知多少";
bo_Arry[0].bianhao = "第00010号";
bo_Arry[0].zuozhe = "郭敬明";
bo_Arry[0].chubanshe = "山东出版社";
bo_Arry[1].mingcheng = "朝花夕拾";
bo_Arry[1].bianhao = "第00011号";
bo_Arry[1].zuozhe = "鲁迅";
bo_Arry[1].chubanshe = "北京出版社";
bo_Arry[2].mingcheng = "三重门";
bo_Arry[2].bianhao = "第00012号";
bo_Arry[2].zuozhe = "韩寒";
bo_Arry[2].chubanshe = "上海出版社";
bo_Arry[3].mingcheng = "那小子真帅";
bo_Arry[3].bianhao = "第00013号";
bo_Arry[3].zuozhe = "可爱淘";
bo_Arry[3].chubanshe = "江苏出版社";
bo_Arry[4].mingcheng = "猫";
bo_Arry[4].bianhao = "第00014号";
bo_Arry[4].zuozhe = "老舍";
bo_Arry[4].chubanshe = "大连出版社";
}
return bo_Arry;
}
static void chaxun(book[] bo_Temp)
{
string i = Console.ReadLine();
for (int q = 0; q < bo_Temp.Length; q++)
{
if (i == bo_Temp[q].mingcheng)
{
PrintAryy(bo_Temp[q]);
}
else if (i == bo_Temp[q].zuozhe)
{
PrintAryy(bo_Temp[q]);
}
else if (i == bo_Temp[q].chubanshe)
{
PrintAryy(bo_Temp[q]);
}
else if (i == bo_Temp[q].bianhao)
{
PrintAryy(bo_Temp[q]);
}
}
Console.WriteLine();
}
static void PrintAryy(book bo_Temp)
{
Console.WriteLine(bo_Temp.bianhao + " " + bo_Temp.mingcheng + " " + bo_Temp.zuozhe + " " + bo_Temp.chubanshe);
}
}
高手们呀````
小弟在这跟各位前辈敬礼了~~~一定要帮我啊```
加我QQ:312425960
真的很级呀```后天我们就要交了,可是我才作出来的不多,而且好多也是自己套的
具体的意思我也还很朦胧```求各位高手帮帮小弟一把啊~~~
[[italic] 本帖最后由 laisx 于 2008-1-6 19:39 编辑 [/italic]]