• 图书管理系统 (单链表实现,C++及文件操作,超详细)


    大家好!这里是小张,五一即将到来,小张在这里提前祝大家劳动节快乐!那么今天小张给大家带来的是由单链表,C++以及文件操作实现的图书信息管理系统。

    另外小张给大家推荐一款什么阶段都适用的刷题神器和模拟面试好用神器点击这里进入神器****

    目录

    图书管理系统菜单

    单链表的实现?

    图书类

    图书管理系统单链表的创建

    文件操作

    陈列信息

    根据编号查找图书

    根据书名查找

    通过图书编号删除图书信息

    插入图书信息

    修改图书信息

    switch语句实现功能

    整体代码

    结果展示

    结束语


    图书管理系统菜单

    void menu()
    {
    	cout << "			******************************************************************" << endl;
    	cout << "			*******************欢迎光临图书管理系统***************************" << endl;
    	cout << "			****************    1.输入-1  退出程序         *******************" << endl;
    	cout << "			****************    2.输入1   录入信息         *******************" << endl;
    	cout << "			****************    3.输入2   陈列信息         *******************" << endl;
    	cout << "			****************    4.输入3   按编号查找       *******************" << endl;
    	cout << "			****************    5.输入4   按书名查找       *******************" << endl;
    	cout << "			****************    6.输入5   删除             *******************" << endl;
    	cout << "			****************    7.输入6   插入             *******************" << endl;
    	cout << "			****************    8.输入7   修改             *******************" << endl;
    	cout << "			******************************************************************" << endl;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    单链表的实现

    ypedef struct londe
    {
    	admin data;//数据域
    	struct londe *next;//指针域
    }londe, *strlonde;
    
    • 1
    • 2
    • 3
    • 4
    • 5

    图书类

    class admin
    {
    public:
    	char name[100];
    	char num[100];
    	char tel[100];
    	char name1[100];
    	char adress[100];
    };
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    图书管理系统单链表的创建

    void londecreat(strlonde&L,int n)
    {
    	L = (strlonde)malloc(sizeof(londe));
    	L->next = NULL;
    	strlonde p, q;
    	q = L;
    	int i =0;
    	cout << "请您依次输入图书编号,图书名,图书作者,图书出版社,价格" << endl;
    	for(i=0;i<n;i++)
    	{
    		p= (strlonde)malloc(sizeof(londe));
    		cin >> p->data.name;
    		cin >> p->data.num;
    		cin >> p->data.tel;
    		cin >> p->data.name1;
    		cin >> p->data.adress;
    		p->next = NULL;
    		q->next = p;
    		q = p;
    	}
    	ofstream ofs;//创建文件流
    	ofs.open("text.txt", ios::out);//指定打开方式(在双引号里,可以根据自行情况进行更改)
    	strlonde S;
    	S = L->next;
    	while (S)
    	{
    		ofs << S->data.name << " " << S->data.num << " " << S->data.tel << " " <<S->data.name1<<" "<<S->data.adress<<" "<< endl;
    		S = S->next;
    	}
    	ofs.close();//关闭文件
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31

    文件操作

    我们为什么要使用文件操作,是因为“许多程序在实现过程中,依赖于把数据保存到变量中,而变量是通过内存单元存储数据的,数据的处理完全由程序控制。当一个程序运行完成或者终止的时候,所有变量的值不再保存。另外,当输入输出数据量较大时,就会受限,带来不便。文件是解决这些问题的有效办法,他通过把数据存储在磁盘文件中,得以长久保存。当有大量数据输入时,可通过编辑工具事先建立输入数据的文件,程序运行时将不再从键盘输入,而是从指定的文件上读入,从而实现数据的一次输入多次使用。”

    写文件分为五步操作:

    1.包含头文件
    #include
    2.创建流对象
    ofstream ofs;
    3.打开文件
    ofs.open(“文件路径”,打开方式);
    4.写数据
    ofs<<“写入的数据”;
    5.关闭文件
    ofs.close();

    读文件也是五步操作:

    1.包含头文件
    #include
    2.创建流对象
    ifstream ifs;
    3.打开文件并判断是否成功
    ifs.open(“文件路径”,打开方式);
    4.读数据
    四种方式读取
    5.关闭文件
    ifs.close();

    具体的代码在图书信息管理系统中实现

    陈列信息

    void display(strlonde&L)
    {
    	ifstream ifs;//创建流对象
    	ifs.open("text.txt",ios::in);//打开文件
    	char buf[10000] = { 0 };
    	int i = 0;
    	cout << "下面是您录入的信息" << endl;
    	while (ifs >> buf)//读取文件中数据
    	{	
    		if (i % 5 == 0)
    		{
    			cout <<endl;
    		}
    		cout << buf << " ";
    		i++;
    	}
    	ifs.close();//关闭文件
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    根据编号查找图书

    void findname(char *arr)
    {
    	char a[100];
    	strcpy_s(a, arr);
    	ifstream ifs;//创建流对象
    	ifs.open("text.txt", ios::in);//打开文件
    	char buf[1000] = { 0 };
    	int i = 0;
    	while (ifs >> buf)//读入文件
    	{
    		int n = strcmp(a, buf);
    		if (n == 0)
    		{
    			cout << buf << " ";
    			i++;
    			continue;
    		}
    		if (i > 5)
    		{
    			return;
    		}
    		if (i <=5 && i >=1)
    		{
    			cout << buf << " ";
    			i++;
    		}
    	}
    	ifs.close();//关闭文件
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29

    根据书名查找

    void findnum(char *arr)
    {
    	char a[100];
    	strcpy_s(a, arr);
    	ifstream ifs;
    	ifs.open("text.txt", ios::in);
    	char buf[10000] = { 0 };
    	int i = 0;
    	while (ifs >> buf)
    	{
    		if (i == 3)
    		{
    			cout << buf << " ";
    			return;
    		}
    		if (i==2)
    		{
    			cout << buf << " ";
    			i++;
    		}
    		if (i == 1)
    		{
    			cout << buf << " ";
    			i++;
    		}
    		int n = strcmp(a, buf);
    		if (n == 0)
    		{
    			cout << buf << " ";
    			i++;
    		}
    	}
    	ifs.close();
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34

    通过图书编号删除图书信息

    void delete1(strlonde&L,char *arr)
    {
    	char a[100], b[100];
    	int i = 0, j = 0, count = 0;
    	strcpy_s(a, arr);
    	while (*arr != '')
    	{
    		count++;
    		arr++;
    	}
    	strlonde p, q, r;
    	q = L;
    	p = L->next;
    	while (p != NULL)
    	{
    		strcpy_s(b, p->data.name);
    		i = 0, j = 0;
    		while (a[i] == b[j] && a[i] != ''&&b[j] != '')
    		{
    			i++;
    			j++;
    		}
    		if (i == count)
    		{
    			r = p;
    			while (q)
    			{
    				while (q->next == r)
    				{
    					q->next = q->next->next;
    					free(r);
    					cout << "删除图书信息成功!" << endl;
    					ofstream ofs;
    					ofs.open("text.txt", ios::out);
    					strlonde S;
    					S = L->next;
    					while (S)
    					{
    						ofs << S->data.name << " " << S->data.num << " " << S->data.tel << " " << S->data.name1 << " " << S->data.adress << " " << endl;
    						S = S->next;
    					}
    					ofs.close();
    					return;
    				}
    				q = q->next;
    			}
    		}
    		p = p->next;
    	}
    	
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51

    插入图书信息

    void insert(strlonde&L, char*arr, char*arr2, char*arr3, char*arr4,char*arr5,char*arr6)
    {	strlonde p, q, s;
    
    	char a[100], b[100];
    	int count = 0, i = 0, j = 0;
    	s = (strlonde)malloc(sizeof(londe));
    	strcpy_s(s->data.name, arr3);
    	strcpy_s(s->data.num, arr2);
    	strcpy_s(s->data.tel, arr4);
    	strcpy_s(s->data.name1, arr5);
    	strcpy_s(s->data.adress, arr6);
    	strcpy_s(a, arr);
    	while (*arr != '')
    	{
    		count++;
    		arr++;
    	}
    	q = L;
    	p = L->next;
    	while (p != NULL)
    	{
    		strcpy_s(b, p->data.name);
    		i = 0, j = 0;
    		while (a[i] == b[j] && a[i] != ''&&b[j] != '')
    		{
    			i++;
    			j++;
    		}
    		if (i == count)
    		{
    			while (q)
    			{
    				while (q->next == p)
    				{
    					q->next = s;
    					s->next = p;
    					cout << "插入成功" << endl;
    					ofstream ofs;
    					ofs.open("text.txt", ios::out);
    					strlonde S;
    					S = L->next;
    					while (S)
    					{
    						ofs << S->data.name << " " << S->data.num << " " << S->data.tel << " " << S->data.name1 << " " << S->data.adress << " " << endl;
    						S = S->next;
    					}
    					ofs.close();
    					return;
    				}
    				q = q->next;
    			}
    		}
    		p = p->next;
    	}
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56

    修改图书信息

    void modify(strlonde&L, char*arr,char*arr1,char*arr2,char*arr3,char*arr4,char*arr5)
    {
    	char a[100], b[100];
    	strcpy_s(a, arr);
    	strlonde p;
    	int count = 0, i = 0, j = 0;
    	while (*arr != '')
    	{
    		count++;
    		arr++;
    	}
    	p = L->next;
    	while (p)
    	{
    		strcpy_s(b, p->data.name);
    		i = 0, j = 0;
    		while (a[i] == b[j] && a[i] != ''&&b[j] != '')
    		{
    			i++;
    			j++;
    		}
    		if (i == count)
    		{
    			strcpy_s(p->data.num, arr1);
    			strcpy_s(p->data.name, arr2);
    			strcpy_s(p->data.tel, arr3);
    			strcpy_s(p->data.name1, arr4);
    			strcpy_s(p->data.adress, arr5);
    			cout << "修改成功" << endl;
    			ofstream ofs;
    			ofs.open("text.txt", ios::out);
    			strlonde S;
    			S = L->next;
    			while (S)
    			{
    				ofs << S->data.name << " " << S->data.num << " " << S->data.tel << " " << S->data.name1 << " " << S->data.adress << " " << endl;
    				S = S->next;
    			}
    			ofs.close();
    			return;
    		}
    		p = p->next;
    	}
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44

    switch语句实现功能

    switch (x)
    		{
    		case 1:
    			cout << "现在开始录入信息,请输入您要录入几本书的信息" << endl;
    			cin >> n;
    			londecreat(L, n);
    			cout << "录入完成" << endl;
    			break;
    		case 2:
    			display(L);
    			break;
    		case 3:
    			cout << "请输入您要进行查找的图书的编号" << endl;
    			cin >> arr;
    			findname(arr);
    			break;
    		case 4:
    			cout << "请输入您要进行查找图书名" << endl;
    			cin >> arr2;
    			findnum(arr2);
    			break;
    		case 5:
    			cout << "请输入您要删除图书的编号" << endl;
    			cin >> arr4;
    			delete1(L, arr4);
    			break;
    		case 6:
    			cout << "请输入您要进行插入地方图书的编号以及插入的图书编号,图书名,图书作者,图书出版社,价格" << endl;
    			cin >> arr5 >> arr6 >> arr7 >> arr8 >> arr13 >> arr14;
    			insert(L, arr5, arr6, arr7, arr8,arr13,arr14);
    			break;
    		case 7:
    			cout << "请输入您要进行修改的用户的编号以及您需要修改的信息" << endl;
    			cin >> arr9 >> arr10 >> arr11 >> arr12 >> arr15 >> arr16;
    			modify(L, arr9, arr10, arr11, arr12,arr15,arr16);
    			break;
    		default:
    			cout << "您的输入有误,请重新输入" << endl;
    		}
    	}
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40

    整体代码

    #include<iostream>
    #include<stdio.h>
    #include<string>
    #include<malloc.h>
    #include<stdlib.h>
    #include<string.h>
    #include<fstream>
    #define Max 1000
    using namespace std;
    class admin
    {
    public:
    	char name[100];
    	char num[100];
    	char tel[100];
    	char name1[100];
    	char adress[100];
    };
    typedef struct londe
    {
    	admin data;
    	struct londe *next;
    }londe, *strlonde;
    void londecreat(strlonde&L,int n)
    {
    	L = (strlonde)malloc(sizeof(londe));
    	L->next = NULL;
    	strlonde p, q;
    	q = L;
    	int i =0;
    	cout << "请您依次输入图书编号,图书名,图书作者,图书出版社,价格" << endl;
    	for(i=0;i<n;i++)
    	{
    		p= (strlonde)malloc(sizeof(londe));
    		cin >> p->data.name;
    		cin >> p->data.num;
    		cin >> p->data.tel;
    		cin >> p->data.name1;
    		cin >> p->data.adress;
    		p->next = NULL;
    		q->next = p;
    		q = p;
    	}
    	ofstream ofs;
    	ofs.open("text.txt", ios::out);
    	strlonde S;
    	S = L->next;
    	while (S)
    	{
    		ofs << S->data.name << " " << S->data.num << " " << S->data.tel << " " <<S->data.name1<<" "<<S->data.adress<<" "<< endl;
    		S = S->next;
    	}
    	ofs.close();
    }
    void display(strlonde&L)
    {
    	ifstream ifs;
    	ifs.open("text.txt",ios::in);
    	char buf[10000] = { 0 };
    	int i = 0;
    	cout << "下面是您录入的信息" << endl;
    	while (ifs >> buf)
    	{	
    		if (i % 5 == 0)
    		{
    			cout <<endl;
    		}
    		cout << buf << " ";
    		i++;
    	}
    	ifs.close();
    }
    void findname(char *arr)
    {
    	char a[100];
    	strcpy_s(a, arr);
    	ifstream ifs;
    	ifs.open("text.txt", ios::in);
    	char buf[1000] = { 0 };
    	int i = 0;
    	while (ifs >> buf)
    	{
    		int n = strcmp(a, buf);
    		if (n == 0)
    		{
    			cout << buf << " ";
    			i++;
    			continue;
    		}
    		if (i > 5)
    		{
    			return;
    		}
    		if (i <=5 && i >=1)
    		{
    			cout << buf << " ";
    			i++;
    		}
    	}
    	ifs.close();
    }
    void findnum(char *arr)
    {
    	char a[100];
    	strcpy_s(a, arr);
    	ifstream ifs;
    	ifs.open("text.txt", ios::in);
    	char buf[10000] = { 0 };
    	int i = 0;
    	while (ifs >> buf)
    	{
    		if (i == 3)
    		{
    			cout << buf << " ";
    			return;
    		}
    		if (i==2)
    		{
    			cout << buf << " ";
    			i++;
    		}
    		if (i == 1)
    		{
    			cout << buf << " ";
    			i++;
    		}
    		int n = strcmp(a, buf);
    		if (n == 0)
    		{
    			cout << buf << " ";
    			i++;
    		}
    	}
    	ifs.close();
    }
    void delete1(strlonde&L,char *arr)
    {
    	char a[100], b[100];
    	int i = 0, j = 0, count = 0;
    	strcpy_s(a, arr);
    	while (*arr != '')
    	{
    		count++;
    		arr++;
    	}
    	strlonde p, q, r;
    	q = L;
    	p = L->next;
    	while (p != NULL)
    	{
    		strcpy_s(b, p->data.name);
    		i = 0, j = 0;
    		while (a[i] == b[j] && a[i] != ''&&b[j] != '')
    		{
    			i++;
    			j++;
    		}
    		if (i == count)
    		{
    			r = p;
    			while (q)
    			{
    				while (q->next == r)
    				{
    					q->next = q->next->next;
    					free(r);
    					cout << "删除图书信息成功!" << endl;
    					ofstream ofs;
    					ofs.open("text.txt", ios::out);
    					strlonde S;
    					S = L->next;
    					while (S)
    					{
    						ofs << S->data.name << " " << S->data.num << " " << S->data.tel << " " << S->data.name1 << " " << S->data.adress << " " << endl;
    						S = S->next;
    					}
    					ofs.close();
    					return;
    				}
    				q = q->next;
    			}
    		}
    		p = p->next;
    	}
    	
    }
    void insert(strlonde&L, char*arr, char*arr2, char*arr3, char*arr4,char*arr5,char*arr6)
    {	strlonde p, q, s;
    
    	char a[100], b[100];
    	int count = 0, i = 0, j = 0;
    	s = (strlonde)malloc(sizeof(londe));
    	strcpy_s(s->data.name, arr3);
    	strcpy_s(s->data.num, arr2);
    	strcpy_s(s->data.tel, arr4);
    	strcpy_s(s->data.name1, arr5);
    	strcpy_s(s->data.adress, arr6);
    	strcpy_s(a, arr);
    	while (*arr != '')
    	{
    		count++;
    		arr++;
    	}
    	q = L;
    	p = L->next;
    	while (p != NULL)
    	{
    		strcpy_s(b, p->data.name);
    		i = 0, j = 0;
    		while (a[i] == b[j] && a[i] != ''&&b[j] != '')
    		{
    			i++;
    			j++;
    		}
    		if (i == count)
    		{
    			while (q)
    			{
    				while (q->next == p)
    				{
    					q->next = s;
    					s->next = p;
    					cout << "插入成功" << endl;
    					ofstream ofs;
    					ofs.open("text.txt", ios::out);
    					strlonde S;
    					S = L->next;
    					while (S)
    					{
    						ofs << S->data.name << " " << S->data.num << " " << S->data.tel << " " << S->data.name1 << " " << S->data.adress << " " << endl;
    						S = S->next;
    					}
    					ofs.close();
    					return;
    				}
    				q = q->next;
    			}
    		}
    		p = p->next;
    	}
    
    }
    void modify(strlonde&L, char*arr,char*arr1,char*arr2,char*arr3,char*arr4,char*arr5)
    {
    	char a[100], b[100];
    	strcpy_s(a, arr);
    	strlonde p;
    	int count = 0, i = 0, j = 0;
    	while (*arr != '')
    	{
    		count++;
    		arr++;
    	}
    	p = L->next;
    	while (p)
    	{
    		strcpy_s(b, p->data.name);
    		i = 0, j = 0;
    		while (a[i] == b[j] && a[i] != ''&&b[j] != '')
    		{
    			i++;
    			j++;
    		}
    		if (i == count)
    		{
    			strcpy_s(p->data.num, arr1);
    			strcpy_s(p->data.name, arr2);
    			strcpy_s(p->data.tel, arr3);
    			strcpy_s(p->data.name1, arr4);
    			strcpy_s(p->data.adress, arr5);
    			cout << "修改成功" << endl;
    			ofstream ofs;
    			ofs.open("text.txt", ios::out);
    			strlonde S;
    			S = L->next;
    			while (S)
    			{
    				ofs << S->data.name << " " << S->data.num << " " << S->data.tel << " " << S->data.name1 << " " << S->data.adress << " " << endl;
    				S = S->next;
    			}
    			ofs.close();
    			return;
    		}
    		p = p->next;
    	}
    }
    void menu()
    {
    	cout << "			******************************************************************" << endl;
    	cout << "			*******************欢迎光临图书管理系统***************************" << endl;
    	cout << "			****************    1.输入-1  退出程序         *******************" << endl;
    	cout << "			****************    2.输入1   录入信息         *******************" << endl;
    	cout << "			****************    3.输入2   陈列信息         *******************" << endl;
    	cout << "			****************    4.输入3   按编号查找       *******************" << endl;
    	cout << "			****************    5.输入4   按书名查找       *******************" << endl;
    	cout << "			****************    6.输入5   删除             *******************" << endl;
    	cout << "			****************    7.输入6   插入             *******************" << endl;
    	cout << "			****************    8.输入7   修改             *******************" << endl;
    	cout << "			******************************************************************" << endl;
    }
    int main()
    {
    	strlonde L;
    	char arr[100], arr2[100], arr4[100], arr5[100], arr6[100], arr7[100], arr8[100], arr9[100], arr10[100], arr11[100], arr12[100], arr13[100], arr14[100], arr15[100], arr16[100];
    	int n = 0;
    	int x = 0;
    	menu();
    	while (cin >> x)
    	{ 
    		if (x < 0)
    		{
    			break;
    		}
    		switch (x)
    		{
    		case 1:
    			cout << "现在开始录入信息,请输入您要录入几本书的信息" << endl;
    			cin >> n;
    			londecreat(L, n);
    			cout << "录入完成" << endl;
    			break;
    		case 2:
    			display(L);
    			break;
    		case 3:
    			cout << "请输入您要进行查找的图书的编号" << endl;
    			cin >> arr;
    			findname(arr);
    			break;
    		case 4:
    			cout << "请输入您要进行查找图书名" << endl;
    			cin >> arr2;
    			findnum(arr2);
    			break;
    		case 5:
    			cout << "请输入您要删除图书的编号" << endl;
    			cin >> arr4;
    			delete1(L, arr4);
    			break;
    		case 6:
    			cout << "请输入您要进行插入地方图书的编号以及插入的图书编号,图书名,图书作者,图书出版社,价格" << endl;
    			cin >> arr5 >> arr6 >> arr7 >> arr8 >> arr13 >> arr14;
    			insert(L, arr5, arr6, arr7, arr8,arr13,arr14);
    			break;
    		case 7:
    			cout << "请输入您要进行修改的用户的编号以及您需要修改的信息" << endl;
    			cin >> arr9 >> arr10 >> arr11 >> arr12 >> arr15 >> arr16;
    			modify(L, arr9, arr10, arr11, arr12,arr15,arr16);
    			break;
    		default:
    			cout << "您的输入有误,请重新输入" << endl;
    		}
    	}
    	return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355

    到这里,这个图书信息管理系统的基本功能就已经全部实现了,下面我们来看看运行后是什么样子:

    结果展示

    这里是刚刚打开时的界面

    录入及陈列信息

    按照编号查找

    按照书名查找

    根据编号删除图书

    插入操作

    保存到txt文件中的样子

    结束语

    到了这里今天的内容就已经全部的结束了,希望小张的图书信息管理系统可以给大家带来帮助,同时也希望大家可以多多支持支持小张,小张在这里提前谢谢大家啦!

  • 相关阅读:
    HTNL---表格标签和列表标签
    Jenkins在Linux环境下的安装与配置
    在网络攻击之前、期间和之后应采取的步骤
    个人网站搭建学习笔记
    MIT6.s081/6.828 lectrue4:page tables 以及 Lab3 心得
    隆云通空气温湿、CO、PM2.5、PM10五参数
    一图看懂CodeArts Inspector 三大特性,带你玩转漏洞管理服务
    2022HBCPC 优美的字符串
    html、css 教程
    半导体工厂电源问题的解决方案-智能MCC控制中心和带有接地保护的EOCR电机保护器!
  • 原文地址:https://blog.csdn.net/m0_61083409/article/details/125398294