c语言图书管理系统附源码是一款由C语言编写的图书管理系统,它是由吾爱论坛网友分享提供的,对于学习C语言的朋友可以借鉴参考学习代码的编写,这也是在大学里初学C语言经常会遇到的课题,欢迎大家下载学习。
猜测大一的同学只要是学习C语言的应该最后都会有课程设计,我们一组当时分配到的题目是写图书馆管理系统。
系统并不是很完善,只是实现功能,望大佬勿喷。
其中程序的主要贡献者是我舍友范同学(Robin),我是负责了其中一部分函数。
为了在课上方便演示,我们把所有的代码全都放到一个源文件里了。
这里把源代码给大家供大家参考。
大家在查看图书信息之前一定要先导入信息(也就是7号功能),不然是读取不到的,导入之前提前在盘符准备好图书 .txt 文件。
管理员账户密码皆为admin(学习C语言的朋友应该都懂)
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
//由506小组编写
struct account
{
char name[10],password[10];
} user[2]= {{"admin","admin"},{"Robin","000000"}};
void gotoxy(int x,int y)
{
COORD pos;
pos.X=x;
pos.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
int color(int c)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),c);
return 0;
}
struct book //定义结构体类型
{
char no[50]; //书号
char name[50]; //书名
char publishday[50]; //出版日期
char chapt[50]; //类别
char writer[50]; //作者
char index[50]; //借阅标记
int repeat; //借阅次数
char add[50]; //备份
} booknum[100];
struct temp
{
char no[50]; //书号
char name[50]; //书名
char publishday[50]; //出版日期
char chapt[50]; //类别
char writer[50]; //作者
char index[50]; //借阅标记
int repeat; //借阅次数
char add[50];
} tempbook;
int i=0;
void menu();
void menu2();
void log_in() //输入并验证账户名
{
char a[10]= {0},b[10]= {0};
int j=-1;
reput:
printf("账户名:");
color(11);
scanf("%s",a);
if(strcmp(a,user[0].name)==0)
j=0;
else if(strcmp(a,user[1].name)==0)
j=1;
else
{
color(7);
printf("请重新输入!n");
goto reput;
}
color(7);
reput2:
printf("密码:");
color(11);
for(int k=0; k<10;)
{
b[k]=getch();
if(b[k]!=13&&b[k]!='b')
{
printf("*");
k++;
}
else if(b[k]=='b'&&k>0)
{
printf("b b");
k--;
}
else if(k<=0)
printf("a");
else
{
b[k]='