文档管理系统c课程设计
㈠ C语言课程设计 学生管理系统设计
学生管理系统设计
我帮你弄
保证能运行
Q我
㈡ c语言课程设计--班级档案管理系统
//****************************************************************************
//**** 说明:密码所在的文件位于c盘,文件名为1.txt。
//**** 学生基本信息最好保存在C盘,文件名为student.txt。
//****************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define N 3
struct student
{
char name[10];
char no[10];
char sex;
int age;
char bnote[100];
};
void print(bool menu)//打印基本信息
{
if (!menu)
{
printf("学生基本信息录入 ,press 1\n");
}
else
{
printf("学生基本信息显示 ,press 2\n");
printf("学生基本信息保存 ,press 3\n");
printf("学生基本信息删除 ,press 4\n");
printf("学生基本信息修改 ,press 5\n");
printf("学生基本信息查询 ,press 6\n");
}
printf("退出学生信息系统 ,press 7\n");
}
bool Check(char pas[6])//密码验证
{
FILE *fp;
char ch;
char a[7]={" "};
int i = 0;
if ((fp=fopen("c:\\1.txt","r"))==NULL)
{
printf("打开文件失败!\n");
exit(0);
}
ch=fgetc(fp);
while (ch!=EOF&&i<6)
{
a[i] = ch;
ch=fgetc(fp);
i++;
}
a[6] = '\0';
if (!strcmp(pas,a))
{
return true;
}
else
{
printf("密码错误\n");
return false;
}
fclose(fp);
}
void GetInfo(struct student *arr,int n)//学生基本信息录入
{
for (int i = 0;i<n;i++)
{
printf("输入学生的基本信息:name no sex age bnote\n");
scanf("%s %s %c %d %s",arr[i].name,arr[i].no,&arr[i].sex,&arr[i].age,arr[i].bnote);
}
}
void Display(struct student* arr,int n)//学生基本信息显示
{
printf("学生信息: Name NO Sex age Note\n");
for (int i = 0;i<n;i++)
{
printf("%15s%15s%15c%15d%15s\n",arr[i].name,arr[i].no,arr[i].sex,arr[i].age,arr[i].bnote);
}
}
void Save(struct student* arr,int n)//学生基本信息保存,保存在c:\\student.txt
{
FILE * fp;
fp= fopen("c:\\student.txt","w+");
if (fp == NULL)
{
printf("文件不存在!\n");
exit(0);
}
fwrite(arr,sizeof(struct student)*n,n,fp);
fclose(fp);
}
void Modfiy(struct student* arr,int n)//学生基本信息修改
{
char number[10];
bool flag=false;
char pass[6];
printf("请输入密码:\n");
scanf("%s",pass);
if (Check(pass))
{
printf("修改学生信息:\n");
printf("请输入学号:\n");
scanf("%s",number);
for (int i =0;i<n;i++)
{
if (!strcmp(number,arr[i].no))
{
printf("infor: name no sex age note\n");
printf("%12s%12s%12c%12d%12s\n",arr[i].name,arr[i].no,
arr[i].sex,arr[i].age,arr[i].bnote);
printf("please input information:\n");
scanf("%s%s%c%d%s",arr[i].name,arr[i].no,&arr[i].sex,&arr[i].age,arr[i].bnote);
Save(arr,n);
flag = true;
}
}
if (flag == false)
{
printf("该学生不存在!:\n");
}
}
}
void Delete(struct student* arr,int n)//学生基本信息删除
{
char number[10];
bool flag=false;
printf("Delete information:\n");
printf("please input the no:\n");
scanf("%s",number);
for (int i =0;i<n;i++)
{
if (!strcmp(number,arr[i].no))
{
strcpy(arr[i].name," ");
strcpy(arr[i].no," ");
strcpy(arr[i].bnote," ");
arr[i].sex = ' ';
arr[i].age = 0;
Save(arr,n);
flag = true;
}
}
if (flag == true)
{
printf("该学生不存在!:\n");
}
}
void Search(struct student* arr,int n)//学生基本信息查询
{
int temp,i;
bool flag=false;
printf("---------------通过学号查询,press 1-------------\n");
printf("---------------通过姓名查询,press 2-----------\n");
printf("---------------通过性别查询,press 3------------\n");
printf("---------------通过年龄查询,press 4------------\n");
printf("---------------退出,press 5 ------------\n");
scanf("%d",&temp);
switch (temp)
{
case 1://按照学号查询
{
char num[10];
printf("请输入学号:\n");
scanf("%s",num);
for ( i =0;i<n;i++)
{
if (!strcmp(num,arr[i].no))
{
printf("%12s%12s%12c%12d%12s\n",arr[i].name,arr[i].no,
arr[i].sex,arr[i].age,arr[i].bnote);
flag = true;
}
}
if (!flag)
{
printf("该学生不存在.\n");
}
}
break;
case 2://按照名字查询
{
char num[10];
printf("please input name:\n");
scanf("%s",num);
for ( i =0;i<n;i++)
{
if (!strcmp(num,arr[i].name))
{
printf("%12s%12s%12c%12d%12s",arr[i].name,arr[i].no,
arr[i].sex,arr[i].age,arr[i].bnote);
flag = true;
}
}
if (!flag)
{
printf("该学生不存在.\n");
}
}
break;
case 3://按照性别查询
{
char ch;
printf("请输入性别:\n");
//scanf("%c",&ch);
ch = getch();
for ( i =0;i<n;i++)
{
if (ch == arr[i].sex)
{
printf("%12s%12s%12c%12d%12s\n",arr[i].name,arr[i].no,
arr[i].sex,arr[i].age,arr[i].bnote);
flag = true;
}
}
if (!flag)
{
printf("t该学生不存在.\n");
}
}
break;
case 4://按照年龄查询
{
char num_age;
printf("请输入年龄:\n");
scanf("%d",&num_age);
for ( i =0;i<n;i++)
{
if (num_age == arr[i].age)
{
printf("%12s%12s%12c%12d%12s\n",arr[i].name,arr[i].no,
arr[i].sex,arr[i].age,arr[i].bnote);
flag = true;
}
}
if (!flag)
{
printf("该学生不存在.\n");
}
}
break;
default:
break;
}
}
void main()
{
struct student arr[N];
char ps[6];
bool flag =false;
printf("请输入密码:\n");
scanf("%s",ps);
flag = Check(ps);
if (flag)
{
int select;
print(false);
scanf("%d",&select);
while (0<select && select <7 )
{
switch (select)
{
case 1:
GetInfo(arr,N);
print(true);
break;
case 2:
Display(arr,N);
print(true);
break;
case 3:
Save(arr,N);
print(true);
break;
case 4:
Delete(arr,N);
print(true);
break;
case 5:
Modfiy(arr,N);
print(true);
break;
case 6:
Search(arr,N);
print(true);
break;
default:
break;
}
printf("请选择:\n");
scanf("%d",&select);
}
}
}
㈢ c语言课程设计:图书管理系统设计的基本思路是什么
图书管理系统主要要求可以录入书籍,添加书目,查找书本信息,删除或修改信息,有的还要求显示是否被借阅等。
一般采用结构体数组,链表,文件操作和自定义函数。主要是需要对基础知识掌握牢固。
先定义结构体,然后对结构体的成员进行定义,选择数组存储书本各种信息。录入信息可以用for和do while循环等来做。
存放信息需要文件操作函数,比如fopen,fwrite等。
删除和添加可以删除节点或者增加节点。
查找之类的可以用字符串操作的各种函数实现。
附上参考源代码
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
#definebooks"f:\books.txt"
#definebooksbak"f:\booksbak.txt"
structbookinfo
{
charisbn[20];
chartitle[30];
charauthor[20];
intcount;
};
structbook
{
structbookinfoonebook;
structbook*next;
};
structbook*searchBook(structbook*listptr,charisbn[])
{
while(listptr!=(structbook*)0)
if(strcmp(listptr->onebook.isbn,isbn)==0)
returnlistptr;
else
listptr=listptr->next;
return(structbook*)0;
}
voidMainSearchbook(structbook*firstptr)
{
structbook*ptr;
charisbnno[20];
printf("请输入ISBN:");
scanf("%s",&isbnno);
ptr=searchBook(firstptr,isbnno);
if(ptr!=(structbook*)0)
{
printf("找到了!!! ");
printf("ISBN:%s ",ptr->onebook.isbn);
printf("Title:%s ",ptr->onebook.title);
printf("Author:%s ",ptr->onebook.author);
}
else
printf("sorry,notfound!!! ");
}intaddBook(structbook*listptr,structbookinfonote)
{
while(listptr->next!=0)
listptr=listptr->next;
listptr->next=(structbook*)malloc(sizeof(structbook));
listptr->next->onebook=note;
listptr->next->next=0;
return0;
}
voidMainAdd(structbook*listptr,FILE*fp)
{
intok;
structbookinfonote;
printf("请输入ISBN:");
scanf("%s",¬e.isbn);
printf("请输入Title:");
scanf("%s",¬e.title);
printf("请输入Author:");
scanf("%s",¬e.author);
ok=addBook(listptr,note);
if(ok==0)
{
//将加入的图书写到文件中保存
fprintf(fp," %s%s%s%d",note.isbn,note.title,note.author,0);
printf("添加图书成功!!! ");
}
else
printf("添加图书失败!!! ");
}
intremoveBook(structbook*listptr,charisbn[])
{
while(listptr->next!=(structbook*)0)
{
if(strcmp(listptr->next->onebook.isbn,isbn)==0)
{
listptr->next=listptr->next->next;
return0;
}
else
listptr=listptr->next;
}
return-1;
}
voidMainRemove(structbook*listptr,FILE*fp)
/************************************************************************/
/*删除书籍函数,通过ISBN删除链表节点,同时删除文件中对应信息*/
/*删除文件中一行,用的是笨方法,把需要的信息写到新文件,删除旧文件,重命名..*/
/************************************************************************/
{
charisbnno[20];
intok;
structbookinfoonebook;
printf("请输入ISBN:");
scanf("%s",&isbnno);
ok=removeBook(listptr,isbnno);
if(!ok)
{
FILE*fpbak;
if((fpbak=fopen(booksbak,"a+"))==NULL)
printf("文件打开失败!!! ");
fseek(fp,0,SEEK_SET);//移到文件开始
while((fscanf(fp,"%s%s%s%d ",&onebook.isbn,&onebook.title,&onebook.author,&onebook.count))!=EOF)
{
if(strcmp(onebook.isbn,isbnno)!=0)
{
fprintf(fpbak,"%s%s%s%d ",onebook.isbn,onebook.title,onebook.author,onebook.count);
}
}
fclose(fp);
fclose(fpbak);
if(remove(books))//删除失败返回非0
{
printf("删除文件失败!!! ");
return;
}
else
if(rename(booksbak,books))//重命名失败返回非0值
{
printf("重命名失败!!! ");
return;
}
printf("删除成功!!! ");
}
else
printf("查无此书!!!");
}
intchoice(void)
{
intc;
printf("1.查看图书 ");
printf("2.添加图书 ");
printf("3.删除图书 ");
printf("4.退出程序 ");
printf("请选择序号:");
returnc=getchar();
//returnc=getche();
printf(" ");
}
intaddEntry(FILE*fp,structbook*firstptr)
/************************************************************************/
/*主要用来加载文件中存放的图书信息*/
/************************************************************************/
{
structbookinfoonebook;
while((fscanf(fp,"%s%s%s%d ",&onebook.isbn,&onebook.title,&onebook.author,&onebook.count))!=EOF)
{
while(firstptr->next!=0)
firstptr=firstptr->next;
firstptr->next=(structbook*)malloc(sizeof(structbook));
firstptr->next->onebook=onebook;
firstptr->next->next=0;
}
return0;
}
intmain(intargc,char*argv[])
{
intch;
structbookfirst;
strcpy(first.onebook.isbn,"123456");
strcpy(first.onebook.title,"ProgrammingC");
strcpy(first.onebook.author,"yhb");
first.next=0;
structbook*firstptr=&first;//链表头指针
FILE*fp;
if((fp=fopen(books,"a+"))==NULL)
printf("文件打开失败!!!");
addEntry(fp,firstptr);
while(1)
{
system("CLS");//清屏
/************************************************************************/
/*想想这里为什么要清空缓冲区?*/
/*由于上一次(choice函数)的getchar(),还有一个' '留在缓冲区....*/
/*可以把这句话注释掉看看,没有这句话会遇到麻烦*/
/*如果不用fflush,可以将上面的getchar()换成getche()*/
/*比较getchar(),getch(),getche()......*/
/************************************************************************/
fflush(stdin);
ch=choice()-48;
switch(ch)
{
case1:
MainSearchbook(firstptr);
break;
case2:
MainAdd(firstptr,fp);
break;
case3:
MainRemove(firstptr,fp);
break;
case4:
printf("谢谢使用... ");
exit(0);
default:
printf("请输入正确序号!");
}
system("PAUSE");
}
return0;
}
㈣ c程序课程设计 图书管理系统
c语言课程设计:
图书管理系统设计,源代码+说明书,安装配置说明,一套,
㈤ 操作系统课程设计,C语言写的文件管理系统
操作系统课程设计,C语言写的文件管理系统 、。要求有没,根据要求可以做的
㈥ 完整的c语言学生管理系统课程设计
10财富值就想要个完整的,特么是穷疯了吧,思路都不告诉你
㈦ C语言课程设计 设计题目管理系统
你好,源代码,实现你所要求的,需要了就聊我