1.书馆借阅系统源代码
2.急求C语言编写的图书管理系统源代码,具体要求如下
3.c语言图书管理系统
4.pythonç¼è¾å¨åªä¸ªå¥½
5.用Python构建仪表盘应用的最佳工具
书馆借阅系统源代码
#include<stdio.h> #include<string.h> #include<conio.h> #include<stdlib.h> #include<ctype.h> #define STACK_INIT_SIZE #define OK 1 #define TRUE 1 #define FALSE 0 #define ERROR 0 struct student /*定义学生类型,用于存放借出的书籍*/ { int carnum; char lendbook[]; }student[]; struct employ /*定义职工类型*/ { int employnum; char employname[]; int employage; char employsex[2]; char employleve[]; long int employtage; }employ[]; struct book /*定义书的类型*/ { int booknum; char bookname[]; char bookcreat[]; int turefalse; /*用于借书和还书模块判断一本书是否借出的条件*/ }book[]; struct car /*借书卡的数据类型*/ { int carnum; char studentname[]; int studentclass; }car[]; huanbook() /*还书函数*/ { FILE *fp,*fp2; /*定义两个文件指针,fp2用于修改数据时设立临时文件用,防止数据遭破坏*/ int i,n; int carnum; char lendbook[]; printf("请你输入你的卡号\n"); scanf("%d",&carnum); fp=fopen("car.txt","r"); /*读取卡号记录*/ for(i=0;fread(&car[i],sizeof(struct car),1,fp)!=0;i++) /*for循环判断卡号是否存在*/ { if(car[i].carnum==carnum) /*卡号存在,进入下一循环*/ { n=i; fclose(fp); printf("请输入你要还的挂单密度源码书的名字\n"); scanf("%s",lendbook); fp=fopen("record.txt","r"); for(i=0;fread(&student[i],sizeof(struct student),1,fp)!=0;i++) /*判断是否借阅了输入的书*/ { if(strcmp(student[i].lendbook,lendbook)==0) /*借阅了该书,进入下一循环,否则出错显示*/ { fclose(fp); fp=fopen("record.txt","r"); fp2=fopen("bookl.txt","w"); for(i=0;fread(&student[i],sizeof(struct student),1,fp)!=0;i++) { if(strcmp(student[i].lendbook,lendbook)==0) { continue; /*删除还掉的书的借书记录*/ } fwrite(&student[i],sizeof(struct student),1,fp2); /*写入原来没还的书的记录*/ } fclose(fp); fclose(fp2); fp=fopen("record.txt","w"); fp2=fopen("bookl.txt","r"); for(i=0;fread(&student[i],sizeof(struct student),1,fp2)!=0;i++) { fwrite(&student[i],sizeof(struct student),1,fp); /*将借书记录信息写回*/ } fclose(fp); fclose(fp2); fopen("bookl.txt","w"); /*清临时文件的记录*/ fclose(fp2); fp=fopen("book.txt","r"); fp2=fopen("bookl.txt","w"); for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++) /*将书的记录写入临时文件,防止因为修改信息破坏以前的记录*/ { if(i==n) { book[i].turefalse=1; fwrite(&book[i],sizeof(struct book),1,fp2); /*将还的书的原来状态设为无人借阅的*/ continue; } fwrite(&book[i],sizeof(struct book),1,fp2); } fclose(fp); fclose(fp2); fp=fopen("book.txt","w"); fp2=fopen("bookl.txt","r"); for(i=0;fread(&book[i],sizeof(struct book),1,fp2)!=0;i++) { fwrite(&book[i],sizeof(struct book),1,fp); /*将临时文件写回*/ } fclose(fp); fclose(fp2); fopen("bookl.txt","w"); /*清临时文件*/ fclose(fp2); printf("还书完毕,按任意键返回\n"); getch(); return 1; } } printf("你没有借这样的书,任意键返回\n"); /*出错提示*/ fclose(fp); getch(); return 0; } } printf("系统没这样的卡,和管理员联系,按任意键返回\n"); /*出错提示*/ fclose(fp); getch(); } findbook() { FILE *fp; char bookname[]; int ture,i; fp=fopen("book.txt","r"); printf("请输入你要查找的书名\n"); scanf("%s",bookname); for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++) { if(strcmp(bookname,book[i].bookname)==0) { if(book[i].turefalse==1) { printf("这本书的详细资料是:%d %s %s 此书现在无人借阅\n按任意键返回\n",book[i].booknum,book[i].bookname,book[i].bookcreat); } else { printf("这本书已经有人借出\n");fclose(fp);return 0;} fclose(fp); return FALSE; } } printf("没有你要查询的书籍\n"); fclose(fp); return FALSE; } findbook1() { FILE *fp; char bookcreat[]; int ture,i; fp=fopen("book.txt","r"); printf("请输入你要查找的作者名\n"); scanf("%s",bookcreat); for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++) { if(strcmp(bookcreat,book[i].bookcreat)==0) { if(book[i].turefalse==1) { printf("这本书的详细资料是:%d %s %s 此书现在无人借阅\n按任意键返回\n",book[i].booknum,book[i].bookname,book[i].bookcreat); } else { printf("这本书已经有人借出\n");fclose(fp);return 0;} fclose(fp); return FALSE; } } printf("没有你要查询的书籍\n"); fclose(fp); return FALSE; } lendcount() { FILE *fp; int i,n=0; fp=fopen("record.txt","r"); for(i=0;fread(&student[i],sizeof(struct student),1,fp)!=0;i++) { printf("卡号:%d 借出的书籍:%s \n",student[i].carnum,student[i].lendbook); n=n+1; } fclose(fp); printf("目前共有%d本书借出\n",n); printf("按任意键\n"); getch(); return n; } chabook() { char ch5; do { printf("---------------欢迎进入图书查询系统!--------------\n"); printf(" 1:<按书名查找>\n"); printf(" 2:<按作者查找>\n"); printf(" 0:<返回>\n"); printf("请输入0--2,其他输入非法!\n"); scanf("%s",&ch5); switch(ch5) { case '1':findbook();getch();break; case '2':findbook1();getch();break; case '0':break; default:printf("无此操作\n");getch();break; } }while(ch5!='0'); return FALSE; } lendbook() { FILE *fp,*fp2; int i,n; int carnum; printf("请你输入你的卡号\n"); scanf("%d",&carnum); fp=fopen("car.txt","r"); for(i=0;fread(&car[i],sizeof(struct car),1,fp)!=0;i++) { if(car[i].carnum==carnum) { n=i; fclose(fp); printf("请输入你要借阅的书的名字\n"); scanf("%s",student[n].lendbook); fp=fopen("book.txt","r"); for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++) { if(strcmp(book[i].bookname,student[n].lendbook)==0) { if(book[i].turefalse==0) { printf("对不起,此书有人借出,请借其他书\n");fclose(fp);getch();return;} else fclose(fp); fp=fopen("record.txt","a+"); student[n].carnum=carnum; fwrite(&student[n],sizeof(struct student),1,fp); fclose(fp); fp=fopen("book.txt","r"); fp2=fopen("bookl.txt","w"); for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++) { if(strcmp(book[i].bookname,student[n].lendbook)==0) { book[i].turefalse=0; fwrite(&book[i],sizeof(struct book),1,fp2); continue; } fwrite(&book[i],sizeof(struct book),1,fp2); } fclose(fp); fclose(fp2); fp=fopen("book.txt","w"); fp2=fopen("bookl.txt","r"); for(i=0;fread(&book[i],sizeof(struct book),1,fp2)!=0;i++) { fwrite(&book[i],sizeof(struct book),1,fp); } fclose(fp); fclose(fp2); fopen("bookl.txt","w"); fclose(fp2); printf("借书完毕,按任意键返回\n"); getch(); return; } } printf("不存在这样的书,任意键返回\n"); fclose(fp); getch(); return; } } printf("你的卡号不存在,请申请新卡,纪念日源码按任意键返回\n"); fclose(fp); getch(); } carcount() { FILE *fp; int i,n=0; fp=fopen("car.txt","r"); for(i=0;fread(&car[i],sizeof(struct car),1,fp)!=0;i++) { printf("第%d张卡<卡号:%d 姓名:%s 班级:%d>\n",i+1,car[i].carnum,car[i].studentname,car[i].studentclass); n=n+1; } fclose(fp); printf("目前共有%d本书\n",n); printf("按任意键\n"); getch(); } delcar() { FILE *fp,*fp2; int i; int carnum; char choice; fp=fopen("car.txt","r"); fp2=fopen("bookl.txt","w"); printf("请输入你要删除的卡号\n"); printf("如果你输入的卡号存在,系统自动删除该信息!如果不存在,系统不做任何改动\n"); scanf("%d",&carnum); for(i=0;fread(&car[i],sizeof(struct car),1,fp)!=0;i++) { if(car[i].carnum!=carnum) { fwrite(&car[i],sizeof(struct car),1,fp2); } } fclose(fp); fclose(fp2); printf("是否真的要删除该卡?删除后该书籍的所有信息将无法恢复《Y/N》\n"); scanf("%s",&choice); if(choice=='y'||choice=='Y') { fp=fopen("car.txt","w"); fp2=fopen("bookl.txt","r"); for(i=0;fread(&car[i],sizeof(struct car),1,fp2)!=0;i++) { fwrite(&car[i],sizeof(struct car),1,fp); } fclose(fp); fclose(fp2); fp2=fopen("bookl.txt","w"); fclose(fp2); printf("按任意键返回\n"); getch(); return; } else { printf("按任意键返回\n"); getch(); return; } } addcar() { FILE *fp; int i=0; fp=fopen("car.txt","a+"); printf("请你输入卡号\n"); scanf("%d",&car[i].carnum); printf("请你输入学生姓名\n"); scanf("%s",car[i].studentname); printf("请你输入班级\n"); scanf("%d",&car[i].studentclass); fwrite(&car[i],sizeof(struct car),1,fp); fclose(fp); printf("输入完毕,任意键返回\n"); getch(); }
急求C语言编写的图书管理系统源代码,具体要求如下
/*这有个以前用过的程序,你可以自己改改使用,但是有些功
能好像有问题,会中断运行。至于程序的缩进式格式就你自己
敲回车和退格解决吧,不然代码看起来会很乱不好看。*/
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
#include<ctype.h>
#define STACK_INIT_SIZE
#define OK 1
#define TRUE 1
#define FALSE 0
#define ERROR 0
struct student /*定义学生类型,用于存放借出的书籍*/
{
int carnum;
char lendbook[];
}student[];
struct employ /*定义职工类型*/
{
int employnum;
char employname[];
int employage;
char employsex[2];
char employleve[];
long int employtage;
}employ[];
struct book /*定义书的类型*/
{
int booknum;
char bookname[];
char bookcreat[];
int turefalse; /*用于借书和还书模块判断一本书是否借出的条件*/
}book[];
struct car /*借书卡的数据类型*/
{
int carnum;
char studentname[];
int studentclass;
}car[];
huanbook() /*还书函数*/
{
FILE *fp,*fp2; /*定义两个文件指针,fp2用于修改数据时设立临时文件用,防止数据遭破坏*/
int i,n;
int carnum;
char lendbook[];
printf("请你输入你的卡号\n");
scanf("%d",&carnum);
fp=fopen("car.txt","r"); /*读取卡号记录*/
for(i=0;fread(&car[i],sizeof(struct car),1,fp)!=0;i++) /*for循环判断卡号是否存在*/
{
if(car[i].carnum==carnum) /*卡号存在,进入下一循环*/
{
n=i;
fclose(fp);
printf("请输入你要还的书的名字\n");
scanf("%s",lendbook);
fp=fopen("record.txt","r");
for(i=0;fread(&student[i],sizeof(struct student),1,fp)!=0;i++) /*判断是否借阅了输入的书*/
{
if(strcmp(student[i].lendbook,lendbook)==0) /*借阅了该书,进入下一循环,否则出错显示*/
{
fclose(fp);
fp=fopen("record.txt","r");
fp2=fopen("bookl.txt","w");
for(i=0;fread(&student[i],sizeof(struct student),1,fp)!=0;i++)
{
if(strcmp(student[i].lendbook,lendbook)==0)
{
continue; /*删除还掉的书的借书记录*/
}
fwrite(&student[i],sizeof(struct student),1,fp2); /*写入原来没还的书的记录*/
}
fclose(fp);
fclose(fp2);
fp=fopen("record.txt","w");
fp2=fopen("bookl.txt","r");
for(i=0;fread(&student[i],sizeof(struct student),1,fp2)!=0;i++)
{
fwrite(&student[i],sizeof(struct student),1,fp); /*将借书记录信息写回*/
}
fclose(fp);
fclose(fp2);
fopen("bookl.txt","w"); /*清临时文件的记录*/
fclose(fp2);
fp=fopen("book.txt","r");
fp2=fopen("bookl.txt","w");
for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++) /*将书的记录写入临时文件,防止因为修改信息破坏以前的白鹭 三消源码记录*/
{
if(i==n)
{
book[i].turefalse=1;
fwrite(&book[i],sizeof(struct book),1,fp2); /*将还的书的原来状态设为无人借阅的*/
continue;
}
fwrite(&book[i],sizeof(struct book),1,fp2);
}
fclose(fp);
fclose(fp2);
fp=fopen("book.txt","w");
fp2=fopen("bookl.txt","r");
for(i=0;fread(&book[i],sizeof(struct book),1,fp2)!=0;i++)
{
fwrite(&book[i],sizeof(struct book),1,fp); /*将临时文件写回*/
}
fclose(fp);
fclose(fp2);
fopen("bookl.txt","w"); /*清临时文件*/
fclose(fp2);
printf("还书完毕,按任意键返回\n");
getch();
return 1;
}
}
printf("你没有借这样的书,任意键返回\n"); /*出错提示*/
fclose(fp);
getch();
return 0;
}
}
printf("系统没这样的卡,和管理员联系,按任意键返回\n"); /*出错提示*/
fclose(fp);
getch();
}
findbook()
{
FILE *fp;
char bookname[];
int ture,i;
fp=fopen("book.txt","r");
printf("请输入你要查找的书名\n");
scanf("%s",bookname);
for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++)
{
if(strcmp(bookname,book[i].bookname)==0)
{
if(book[i].turefalse==1)
{
printf("这本书的详细资料是:%d %s %s 此书现在无人借阅\n按任意键返回\n",book[i].booknum,book[i].bookname,book[i].bookcreat);
}
else { printf("这本书已经有人借出\n");fclose(fp);return 0;}
fclose(fp);
return FALSE;
}
}
printf("没有你要查询的书籍\n");
fclose(fp);
return FALSE;
}
findbook1()
{
FILE *fp;
char bookcreat[];
int ture,i;
fp=fopen("book.txt","r");
printf("请输入你要查找的作者名\n");
scanf("%s",bookcreat);
for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++)
{
if(strcmp(bookcreat,book[i].bookcreat)==0)
{
if(book[i].turefalse==1)
{
printf("这本书的详细资料是:%d %s %s 此书现在无人借阅\n按任意键返回\n",book[i].booknum,book[i].bookname,book[i].bookcreat);
}
else { printf("这本书已经有人借出\n");fclose(fp);return 0;}
fclose(fp);
return FALSE;
}
}
printf("没有你要查询的书籍\n");
fclose(fp);
return FALSE;
}
lendcount()
{
FILE *fp;
int i,n=0;
fp=fopen("record.txt","r");
for(i=0;fread(&student[i],sizeof(struct student),1,fp)!=0;i++)
{
printf("卡号:%d 借出的书籍:%s \n",student[i].carnum,student[i].lendbook);
n=n+1;
}
fclose(fp);
printf("目前共有%d本书借出\n",n);
printf("按任意键\n");
getch();
return n;
}
chabook()
{
char ch5;
do
{
printf("---------------欢迎进入图书查询系统!--------------\n");
printf(" 1:<按书名查找>\n");
printf(" 2:<按作者查找>\n");
printf(" 0:<返回>\n");
printf("请输入0--2,其他输入非法!\n");
scanf("%s",&ch5);
switch(ch5)
{
case '1':findbook();getch();break;
case '2':findbook1();getch();break;
case '0':break;
default:printf("无此操作\n");getch();break;
}
}while(ch5!='0');
return FALSE;
}
lendbook()
{
FILE *fp,*fp2;
int i,n;
int carnum;
printf("请你输入你的卡号\n");
scanf("%d",&carnum);
fp=fopen("car.txt","r");
for(i=0;fread(&car[i],sizeof(struct car),1,fp)!=0;i++)
{
if(car[i].carnum==carnum)
{
n=i;
fclose(fp);
printf("请输入你要借阅的书的名字\n");
scanf("%s",student[n].lendbook);
fp=fopen("book.txt","r");
for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++)
{
if(strcmp(book[i].bookname,student[n].lendbook)==0)
{
if(book[i].turefalse==0) { printf("对不起,此书有人借出,请借其他书\n");fclose(fp);getch();return;}
else
fclose(fp);
fp=fopen("record.txt","a+");
student[n].carnum=carnum;
fwrite(&student[n],sizeof(struct student),1,fp);
fclose(fp);
fp=fopen("book.txt","r");
fp2=fopen("bookl.txt","w");
for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++)
{
if(strcmp(book[i].bookname,student[n].lendbook)==0)
{
book[i].turefalse=0;
fwrite(&book[i],sizeof(struct book),1,fp2);
continue;
}
fwrite(&book[i],sizeof(struct book),1,fp2);
}
fclose(fp);
fclose(fp2);
fp=fopen("book.txt","w");
fp2=fopen("bookl.txt","r");
for(i=0;fread(&book[i],sizeof(struct book),1,fp2)!=0;i++)
{
fwrite(&book[i],sizeof(struct book),1,fp);
}
fclose(fp);
fclose(fp2);
fopen("bookl.txt","w");
fclose(fp2);
printf("借书完毕,按任意键返回\n");
getch();
return;
}
}
printf("不存在这样的书,任意键返回\n");
fclose(fp);
getch();
return;
}
}
printf("你的卡号不存在,请申请新卡,按任意键返回\n");
fclose(fp);
getch();
}
carcount()
{
FILE *fp;
int i,n=0;
fp=fopen("car.txt","r");
for(i=0;fread(&car[i],sizeof(struct car),1,fp)!=0;i++)
{
printf("第%d张卡<卡号:%d 姓名:%s 班级:%d>\n",i+1,car[i].carnum,car[i].studentname,car[i].studentclass);
n=n+1;
}
fclose(fp);
printf("目前共有%d本书\n",n);
printf("按任意键\n");
getch();
}
delcar()
{
FILE *fp,*fp2;
int i;
int carnum;
char choice;
fp=fopen("car.txt","r");
fp2=fopen("bookl.txt","w");
printf("请输入你要删除的卡号\n");
printf("如果你输入的卡号存在,系统自动删除该信息!如果不存在,系统不做任何改动\n");
scanf("%d",&carnum);
for(i=0;fread(&car[i],sizeof(struct car),1,fp)!=0;i++)
{
if(car[i].carnum!=carnum)
{
fwrite(&car[i],sizeof(struct car),1,fp2);
}
}
fclose(fp);
fclose(fp2);
printf("是否真的要删除该卡?删除后该书籍的所有信息将无法恢复《Y/N》\n");
scanf("%s",&choice);
if(choice=='y'||choice=='Y')
{
fp=fopen("car.txt","w");
fp2=fopen("bookl.txt","r");
for(i=0;fread(&car[i],sizeof(struct car),1,fp2)!=0;i++)
{
fwrite(&car[i],sizeof(struct car),1,fp);
}
fclose(fp);
fclose(fp2);
fp2=fopen("bookl.txt","w");
fclose(fp2);
printf("按任意键返回\n");
getch();
return;
}
else
{
printf("按任意键返回\n");
getch();
return;
}
}
addcar()
{
FILE *fp;
int i=0;
fp=fopen("car.txt","a+");
printf("请你输入卡号\n");
scanf("%d",&car[i].carnum);
printf("请你输入学生姓名\n");
scanf("%s",car[i].studentname);
printf("请你输入班级\n");
scanf("%d",&car[i].studentclass);
fwrite(&car[i],sizeof(struct car),1,fp);
fclose(fp);
printf("输入完毕,任意键返回\n");
getch();
}
changemploy()
{
FILE *fp,*fp2;
char employname[],choice;
int i;
fp=fopen("employ.txt","r");
fp2=fopen("bookl.txt","w");
printf("请你输入要修改的职工的名字\n");
scanf("%s",employname);
for(i=0;fread(&employ[i],sizeof(struct employ),1,fp)!=0;i++)
{
if(strcmp(employ[i].employname,employname)==0)
{
printf("你所要修改的职工的资料如下,请选择你要修改的内容\n");
printf("<职工号:%d职工名:%s 年龄:%d 性别:%s 学历:%s 工资:%d>\n",employ[i].employnum,employ[i].employname,employ[i].employage,employ[i].employsex,employ[i].employleve,employ[i].employtage);
printf("2:修改职工名\n");
printf("3:修改职工年龄\n");
printf("4:修改职工工资\n");
printf("5:修改职工学历\n");
printf("请输入1-5:");
scanf("%s",&choice);
switch(choice)
{
case '1':
{
printf("请输入新的职工号\n");
scanf("%d",&employ[i].employnum);
fwrite(&employ[i],sizeof(struct employ),1,fp2);
}break;
case '2':
{
printf("请输入新的职工姓名\n");
scanf("%s",employ[i].employname);
fwrite(&employ[i],sizeof(struct employ),1,fp2);
}break;
case '3':
{
printf("请输入新的年龄\n");
scanf("%d",&employ[i].employage);
fwrite(&employ[i],sizeof(struct employ),1,fp2);
}break;
case '4':
{
printf("请输入新的职工工资\n");
scanf("%d",&employ[i].employtage);
fwrite(&employ[i],sizeof(struct employ),1,fp2);
}break;
case '5':
{
printf("请输入新的职工学历\n");
scanf("%s",employ[i].employleve);
fwrite(&employ[i],sizeof(struct employ),1,fp2);
}
default:printf("没有这样的操作");break;
}
continue;
}
fwrite(&employ[i],sizeof(struct employ),1,fp2);
}
fclose(fp);
fclose(fp2);
fp=fopen("employ.txt","w");
fp2=fopen("bookl.txt","r");
for(i=0;fread(&employ[i],sizeof(struct employ),1,fp2)!=0;i++)
{
fwrite(&employ[i],sizeof(struct employ),1,fp);
}
fclose(fp);
fclose(fp2);
fp2=fopen("bookl.txt","w");
fclose(fp2);
printf("按任意键返回\n");
getchar();
return;
}
delemploy()
{
FILE *fp,*fp2;
int i;
char employname[],choice;
fp=fopen("employ.txt","r");
fp2=fopen("bookl.txt","w");
printf("请输入你要删除的职工名\n");
printf("如果你输入的职工存在,系统自动删除该信息!如果不存在,系统不做任何改动\n");
scanf("%s",推倒胡麻将源码employname);
for(i=0;fread(&employ[i],sizeof(struct employ),1,fp)!=0;i++)
{
if(strcmp(employname,employ[i].employname)!=0)
{
fwrite(&employ[i],sizeof(struct employ),1,fp2);
}
}
fclose(fp);
fclose(fp2);
printf("是否真的要删除该职工信息?删除后的所有信息将无法恢复《Y/N》\n");
scanf("%s",&choice);
if(choice=='y'||choice=='Y')
{
fp=fopen("employ.txt","w");
fp2=fopen("bookl.txt","r");
for(i=0;fread(&employ[i],sizeof(struct employ),1,fp2)!=0;i++)
{
fwrite(&employ[i],sizeof(struct employ),1,fp);
}
fclose(fp);
fclose(fp2);
fp2=fopen("bookl.txt","w");
fclose(fp2);
printf("按任意键返回\n");
getch();
return TRUE;
}
else
{
printf("按任意键返回\n");
getch();
return FALSE;
}
}
employcount()
{
FILE *fp;
int i,n=0;
fp=fopen("employ.txt","r");
for(i=0;fread(&employ[i],sizeof(struct employ),1,fp)!=0;i++)
{
printf("第%d职工的信息如下:\n<职工号:%d 职工名:%s 年龄:%d 性别:%s 学历:%s 工资:%d>\n",n+1,employ[i].employnum,employ[i].employname,employ[i].employage,employ[i].employsex,employ[i].employleve,employ[i].employtage);
n++;
}
fclose(fp);
printf("目前共有%d个职工\n",n);
printf("按任意键返回\n");
}
addemploy()
{
FILE *fp;
char choice='y';
int i=1;
fp=fopen("employ.txt","a+");
while(choice=='y'||choice=='Y')
{
printf("请你输入职工号码\n");
scanf("%d",&employ[i].employnum);
printf("请你输入职工名\n");
scanf("%s",employ[i].employname);
printf("请输入职工年龄\n");
scanf("%d",&employ[i].employage);
printf("请你输入性别\n");
scanf("%s",employ[i].employsex);
printf("请你输入职工的学历水平\n");
scanf("%s",employ[i].employleve);
printf("请输入职工的工资\n");
scanf("%d",&employ[i].employtage);
fwrite(&employ[i],sizeof(struct employ),1,fp);
printf("是否要输入下个职工信息?\n");
scanf("%s",&choice);
}
printf("按任意键返回\n");
fclose(fp);
}
addbook()
{
FILE *fp;
int i=0;
char choice='y';
fp=fopen("book.txt","a+");
while(choice=='y'||choice=='Y')
{
printf("请你输入第%d本书的序号\n",i+1);
scanf("%d",&book[i].booknum);
printf("请你输入书名\n");
scanf("%s",book[i].bookname);
printf("请你输入书的作者\n");
scanf("%s",book[i].bookcreat);
printf("请设为1或0,1代表书还没人借,0表示书已经借出,设其他值,程序运行时无法得出正常结果\n");
printf("请你设定书的状态\n");
scanf("%d",&book[i].turefalse);
fwrite(&book[i],sizeof(struct book),1,fp);
printf("是否要输入下本书\n");
scanf("%s",&choice);
}
fclose(fp);
}
bookcount()
{
FILE *fp;
int i,n=0;
fp=fopen("book.txt","r");
for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++)
{
if(book[i].booknum!=0&&strlen(book[i].bookname)!=0&&strlen(book[i].bookcreat)!=0)
{
printf("第%d本书<序号:%d 书名:%s 作者:%s 状态:%d>\n",i+1,book[i].booknum,book[i].bookname,book[i].bookcreat,book[i].turefalse);
n=n+1;
}
}
fclose(fp);
printf("目前共有%d本书\n",n);
printf("按任意键\n");
}
delbook()
{
FILE *fp,*fp2;
int i;
char bookname[],choice;
fp=fopen("book.txt","r");
fp2=fopen("bookl.txt","w");
printf("请输入你要删除的书名\n");
printf("如果你输入的书名存在,系统自动删除该信息!如果不存在,系统不做任何改动\n");
scanf("%s",bookname);
for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++)
{
if(strcmp(bookname,book[i].bookname)!=0)
{
fwrite(&book[i],sizeof(struct book),1,fp2);
}
}
fclose(fp);
fclose(fp2);
printf("是否真的要删除该书籍?删除后该书籍的所有信息将无法恢复《Y/N》\n");
scanf("%s",&choice);
if(choice=='y'||choice=='Y')
{
fp=fopen("book.txt","w");
fp2=fopen("bookl.txt","r");
for(i=0;fread(&book[i],sizeof(struct book),1,fp2)!=0;i++)
{
fwrite(&book[i],sizeof(struct book),1,fp);
}
fclose(fp);
fclose(fp2);
fp2=fopen("bookl.txt","w");
fclose(fp2);
printf("按任意键返回\n");
getch();
return;
}
else
{
printf("按任意键返回\n");
getch();
return;
}
}
changebook()
{
FILE *fp,*fp2;
char bookname[],choice;
int i;
fp=fopen("book.txt","r");
fp2=fopen("bookl.txt","w");
printf("请你输入要修改的书籍的书字\n");
scanf("%s",bookname);
for(i=0;fread(&book[i],sizeof(struct book),1,fp)!=0;i++)
{
if(strcmp(book[i].bookname,bookname)==0)
{
printf("你所要修改的书的资料如下,请选择你要修改的内容\n");
printf("序号:〈%d〉 书名:〈%s〉 作者:〈%s〉 \n",book[i].booknum,book[i].bookname,book[i].bookcreat);
printf("1:修改书的序号\n");
printf("2:修改书名\n");
printf("3:修改作者\n");
printf("请输入1-3:");
scanf("%s",&choice);
switch(choice)
{
case '1':
{
printf("请输入新的序号\n");
scanf("%d",&book[i].booknum);
fwrite(&book[i],sizeof(struct book),1,fp2);
}break;
case '2':
{
printf("请输入新的书名\n");
scanf("%s",book[i].bookname);
fwrite(&book[i],sizeof(struct book),1,fp2);
}break;
case '3':
{
printf("请输入新的作者\n");
scanf("%s",book[i].bookcreat);
fwrite(&book[i],sizeof(struct book),1,fp2);
}break;
defaut:printf("没有这样的操作");break;
}
continue;
}
fwrite(&book[i],sizeof(struct book),1,fp2);
}
fclose(fp);
fclose(fp2);
fp=fopen("book.txt","w");
fp2=fopen("bookl.txt","r");
for(i=0;fread(&book[i],sizeof(struct book),1,fp2)!=0;i++)
{
fwrite(&book[i],sizeof(struct book),1,fp);
}
fclose(fp2);
fp2=fopen("bookl.txt","w");
fclose(fp2);
printf("按任意键返回\n");
getchar();
return;
}
main()
{
char ch1,ch2,ch3,ch4,ch5;
do
{
printf("\t\t请你选择操作类型:\n");
printf(" 1:<查阅图书>\n");
printf(" 2:<借阅图书>\n");
printf(" 3:<管理系统>\n");
printf(" 4:<还书>\n");
printf(" 0:<退出>\n");
printf("请输入0--4\n");
scanf("%s",&ch1);
switch(ch1)
{
case '1':chabook();break;
case '2':lendbook();;break;
case '3':{
do
{
printf("---------------欢迎进入管理系统!--------------\n");
printf(" 1:<增加图书>\n");
printf(" 2:<删除图书>\n");
printf(" 3:<修改图书资料>\n");
printf(" 4:<书籍统计>\n");
printf(" 5:<职工管理系统>\n");
printf(" 6:<学生管理系统>\n");
printf(" 0:<返回>\n");
printf("请输入0--6,其他输入非法!\n");
scanf("%s",&ch2);
switch(ch2)
{
case '1':addbook();
break;
case '2':delbook();break;
case '3':changebook();break;
case '4':bookcount();getch();break;
case '5':{ do
{
printf("---------------欢迎进入职工管理系统!--------------\n");
printf(" 1:<增加员工>\n");
printf(" 2:<删除员工>\n");
printf(" 3:<修改员工资料>\n");
printf(" 4:<员工统计>\n");
printf(" 0:<返回>\n");
printf("请输入0--4,其他输入非法!\n");
scanf("%s",&ch3);
switch(ch3)
{
case '1':addemploy();getch();break;
case '2':delemploy();break;
case '3':changemploy();break;
case '4':employcount();getch();break;
case '0':break;
default:printf("无此操作\n");getch();break;
}
}while(ch3!='0');}break;
case '6':{
do
{
printf("---------------欢迎进入学生管理系统!--------------\n");
printf(" 1:<申请新卡>\n");
printf(" 2:<删除卡号>\n");
printf(" 3:<借书统计>\n");
printf(" 4:<卡号统计>\n");
printf(" 0:<返回>\n");
printf("请输入0--4,其他输入非法!\n");
scanf("%s",&ch4);
switch(ch4)
{
case '1':addcar();break;
case '2':delcar();break;
case '3':lendcount();break;
case '4':carcount();break;
case '0':break;
default:printf("无此操作\n");getch();break;
}
}while(ch4!='0');}break;
case '0':break;
default:printf("无此操作\n");getch();break;
}
}while(ch2!='0');}break;
case '4':huanbook();break;
case '0':break;
default:printf("无此操作\n");getch();break;
}
}while(ch1!='0');
}
c语言图书管理系统
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
typedef int BOOL;
typedef struct bookinfo
{
char number[];/*产品编号*/
char name[];/*产品名称*/
float price;/*单价*/
char auther[];/*作者*/
BOOL isExit;/*存在状态*/
char lendername[];/*借书人姓名*/
char lendersex[2];/*借书人性别*/
char lendernum[];/*借书人学号*/
}BOOKINFO;
void menu()
{
printf("\n\n\n\n\n\n\n");
printf("\t\t\t图书管理系统\n");
printf("\t\t\t1:新进图书基本信息的输入\n");
printf("\t\t\t2:显示全部记录\n");
printf("\t\t\t3:根据图书名称查询图书基本信息\n");
printf("\t\t\t4:根据图书名称对撤销的图书信息进行删除\n");
printf("\t\t\t5:按照图书名称从小大到排序\n");
printf("\t\t\t6:统计某价格以上的图书数量\n");
printf("\t\t\t7:列出所有未借出去的图书信息\n");
printf("\t\t\t8:退出\n");
}
void choice_1_input_new()/*输入新进的图书信息*/
{
char choice;
FILE *p;
BOOKINFO newbook;
system("cls");
while(1)
{
printf("输入图书编号:");
gets(newbook.number);
printf("输入图书名称:");
gets(newbook.name);
printf("输入图书单价:");
scanf("%f",&newbook.price);
while(getchar()!='\n');
printf("输入图书的作者:");
gets(newbook.auther);
printf("输入借书人姓名:");
gets(newbook.lendername);
printf("输入借书人性别:");
gets(newbook.lendersex);
printf("输入借书人学号:");
gets(newbook.lendernum);
printf("是否保存该条书目?(Y/N)\n");
choice=getch();
while(choice!='Y'&&choice!='y'&&choice!='N'&&choice!='n')
choice=getch();
if(choice=='Y'||choice=='y')
{
newbook.isExit=1;/*将图书状态设置成1,表示没有借出*/
p=fopen("c:\\bookinfo.data","ab");
fwrite(&newbook,sizeof(BOOKINFO),1,p);
fclose(p);
printf("\n该条书目已添加到c:\\bookinfo.data文件中!\n");
}
else
{
printf("\n本条书目未保存!\n");
}
printf("\n是否继续添加书目?(Y/N)\n");
choice=getch();
while(choice!='Y'&&choice!='y'&&choice!='N'&&choice!='n')
choice=getch();
if(choice=='Y'||choice=='y')
continue;
else
break;
}
}
void choice_2_display_all()/*显示全部图书信息*/
{
FILE *p;
int n;
BOOKINFO bookinfo[];
int booknumber=0;
system("cls");
p=fopen("c:\\bookinfo.data","rb");
while(!feof(p))
{
fread(&bookinfo[booknumber],sizeof(BOOKINFO),1,p);
booknumber++;
}
/*booknumber--;使用feof()函数会多读一行,因此需要booknumber自减一次,使书目的数量正确*/
fclose(p);
booknumber--;
if(booknumber==0)
{
printf("没有任何图书信息!\n\n");
}
else
{
n=0;
printf(" 图书信息如下\n");
printf(" 图书信息 | 借书人信息 \n");
printf("编号 名称 单价 作者 图书状态 | 姓名 性别 学号\n");
while(n<booknumber)
{
printf("%-6s%-s%-8.1f%-8s%-9d| %-s%-8s%-8s\n",
bookinfo[n].number,bookinfo[n].name,bookinfo[n].price,
bookinfo[n].auther,bookinfo[n].isExit,bookinfo[n].lendername,
bookinfo[n].lendersex,bookinfo[n].lendernum);
n++;
}
}
printf("\n\n按任意键回到主菜单!\n");
getch();
}
void choice_3_search_according_name()/*根据图书名称显示图书的信息*/
{
char search[]="";/*search用来存放要查询的书名*/
int n;
FILE *p;
char choice;
BOOKINFO bookinfo[];
int booknumber=0;
system("cls");
p=fopen("c:\\bookinfo.data","rb");
while(!feof(p))
{
fread(&bookinfo[booknumber],sizeof(BOOKINFO),1,p);
booknumber++;
}
booknumber--;/*使用feof()函数会多读一行,因此需要booknumber自减一次,炸金花游戏源码使书目的数量正确*/
fclose(p);
while(1)
{
printf("输入要查询的书本名称:");
gets(search);
if(booknumber==0)
{
printf("书库中没有任何信息!\n\n");
printf("按任意键回到主菜单!\n\n");
getch();
break;
}/*if结束*/
else
{
for(n=0;n<booknumber;n++)
if(strcmp(bookinfo[n].name,search)==0)
{
printf("该书的详细信息如下:\n");
printf(" 图书信息 | 借书人信息 \n");
printf("编号 名称 单价 作者 图书状态 | 姓名 性别 学号\n");
printf("%-6s%-s%-8.1f%-8s%-9d| %-s%-8s%-8s\n",
bookinfo[n].number,bookinfo[n].name,bookinfo[n].price,
bookinfo[n].auther,bookinfo[n].isExit,bookinfo[n].lendername,
bookinfo[n].lendersex,bookinfo[n].lendernum);
break;
}
if(n>=booknumber)
printf("没有查找该书的任何信息!\n");
printf("\n\n是否继续查询?(Y/N)\n");
choice=getch();
while(choice!='Y'&&choice!='y'&&choice!='N'&&choice!='n')
choice=getch();
if(choice=='Y'||choice=='y')
continue;
else
break;
}/*else结束*/
}/*while(1)结束*/
}
void choice_4_delete_according_name()/*根据图书名称对图书信息进行删除*/
{
char search[]="";/*search用来存放要删除的书名*/
int n,i;
FILE *p;
char choice;
BOOKINFO bookinfo[];
int booknumber;
system("cls");
while(1)
{
printf("输入要删除的书本名称:");
gets(search);
p=fopen("c:\\bookinfo.data","rb");
booknumber=0;
while(!feof(p))
{
fread(&bookinfo[booknumber],sizeof(BOOKINFO),1,p);
booknumber++;
}
booknumber--;/*使用feof()函数会多读一行,因此需要booknumber自减一次,使书目的数量正确*/
fclose(p);
if(booknumber==0)
{
printf("书库中没有任何信息!\n\n");
printf("按任意键回到主菜单!\n\n");
getch();
break;
}/*if结束*/
else
{
for(n=0;n<booknumber;n++)
if(strcmp(bookinfo[n].name,search)==0)
{
break;
}
if(n>=booknumber)
printf("没有查找该书的任何信息!\n");
else
{
printf("是否确认需要删除该条书目?(Y/N)");
choice=getch();
while(choice!='Y'&&choice!='y'&&choice!='N'&&choice!='n')
choice=getch();
if(choice=='Y'||choice=='y')
{
for(i=n;i<booknumber-1;i++)
bookinfo[i]=bookinfo[i+1];
booknumber--;
p=fopen("c:\\bookinfo.data","wb");
for(n=0;n<booknumber;n++)
fwrite(&bookinfo[n],sizeof(BOOKINFO),1,p);
fclose(p);
printf("删除成功!\n");
}
else
printf("\n\n该条书目没有被删除!");
}
printf("\n\n是否继续进行删除操作?(Y/N)\n");
choice=getch();
while(choice!='Y'&&choice!='y'&&choice!='N'&&choice!='n')
choice=getch();
if(choice=='Y'||choice=='y')
continue;
else
break;
}/*else结束*/
}/*while(1)结束*/
}
void choice_5_sort_according_name()/*根据图书名称排序*/
{
FILE *p;
int m,n;
BOOKINFO temp;
BOOKINFO bookinfo[];
int booknumber;
p=fopen("c:\\bookinfo.data","rb");
booknumber=0;
system("cls");
while(!feof(p))
{
fread(&bookinfo[booknumber],sizeof(BOOKINFO),1,p);
booknumber++;
}
booknumber--;/*使用feof()函数会多读一行,因此需要booknumber自减一次,使书目的数量正确*/
fclose(p);
if(booknumber==0)
{
printf("没有任何图书信息!\n\n");
}
else
{
for(m=0;m<booknumber-1;m++)
for(n=m+1;n<booknumber;n++)
if(strcmp(bookinfo[m].name,bookinfo[n].name)>0)
{
temp=bookinfo[m];
bookinfo[m]=bookinfo[n];
bookinfo[n]=temp;
}
p=fopen("c:\\bookinfo.data","wb");
for(m=0;m<booknumber;m++)
fwrite(&bookinfo[m],sizeof(BOOKINFO),1,p);
fclose(p);
printf("\n\n完成排序!\n\n");
}
printf("按任意键回到主菜单!\n");
getch();
}
void choice_6_display_high_price()/*根据价格列出图书信息*/
{
float price;
FILE *p;
int n;
int count=0;
BOOKINFO bookinfo[];
int booknumber;
system("cls");
printf("请输入价格:");
scanf("%f",&price);
p=fopen("c:\\bookinfo.data","rb");
booknumber=0;
while(!feof(p))
{
fread(&bookinfo[booknumber],sizeof(BOOKINFO),1,p);
booknumber++;
}
booknumber--;/*使用feof()函数会多读一行,因此需要booknumber自减一次,使书目的数量正确*/
fclose(p);
if(booknumber==0)
{
printf("没有任何图书信息!\n\n");
}
else
{
for(n=0;n<booknumber;n++)
{
if(bookinfo[n].price>=price)
count++;
}
if(count==0)
printf("书库中没有比%.1f$价格高的图书!",price);
else
{
printf(" 价格高于%.1f$的图书信息如下\n",price);
printf(" 图书信息 | 借书人信息 \n");
printf("编号 名称 单价 作者 图书状态 | 姓名 性别 学号\n");
for(n=0;n<booknumber;n++)
{
if(bookinfo[n].price>=price)
printf("%-6s%-s%-8.1f%-8s%-9d| %-s%-8s%-8s\n",
bookinfo[n].number,bookinfo[n].name,bookinfo[n].price,
bookinfo[n].auther,bookinfo[n].isExit,bookinfo[n].lendername,
bookinfo[n].lendersex,bookinfo[n].lendernum);
}
}
}
printf("\n\n按任意键回到主菜单!\n");
getch();
}
void choice_7_display_according_exitflag()/*根据存在状态列出图书信息*/
{
FILE *p;
int n;
int count=0;
BOOKINFO bookinfo[];
int booknumber;
system("cls");
booknumber=0;
p=fopen("c:\\bookinfo.data","rb");
while(!feof(p))
{
fread(&bookinfo[booknumber],sizeof(BOOKINFO),1,p);
booknumber++;
}
booknumber--;
fclose(p);
if(booknumber==0)
{
printf("书库中没有任何书目存在!\n");
}
else
{
for(n=0;n<booknumber;n++)
if(bookinfo[n].isExit==1)
count++;
if(count==0)
printf("书库中的书籍全部借出!\n");
else
{
printf("书库中未被借出的图书信息如下:\n\n");
printf(" 图书信息 | 借书人信息 \n");
printf("编号 名称 单价 作者 图书状态 | 姓名 性别 学号\n");
for(n=0;n<booknumber;n++)
if(bookinfo[n].isExit==1)
{
printf("%-6s%-s%-8.1f%-8s%-9d| %-s%-8s%-8s\n",
bookinfo[n].number,bookinfo[n].name,bookinfo[n].price,
bookinfo[n].auther,bookinfo[n].isExit,bookinfo[n].lendername,
bookinfo[n].lendersex,bookinfo[n].lendernum);
}
}
}
printf("\n按任意键返回主菜单!\n");
getch();
}
void main()
{
char choice;
clock_t tm;
FILE *p;
if((p=fopen("c:\\bookinfo.data","rb"))==NULL)
{
p=fopen("c:\\bookinfo.data","wb");
fclose(p);
}
while(1)
{
system("cls");
menu();
choice=getch();
switch(choice)
{
case '1':choice_1_input_new();break;/*输入新进的图书信息*/
case '2':choice_2_display_all();break;/*显示全部图书信息*/
case '3':choice_3_search_according_name();break;/*根据图书名称显示图书的信息*/
case '4':choice_4_delete_according_name();break;/*根据图书名称对图书信息进行删除*/
case '5':choice_5_sort_according_name();break;/*根据图书名称排序*/
case '6':choice_6_display_high_price();break;/*根据价格列出图书信息*/
case '7':choice_7_display_according_exitflag();break;/*根据存在状态列出图书信息*/
case '8':printf("\n\n\t\t\t谢谢使用,再见!\n\t\t\t按任意键退出!\n");getch();return;
default:
printf("\n\n\t\t\t请输入菜单中的数字!(1~8)");
tm=clock();
while(clock()<tm+);
break;
}
}
}
写的很赶,不知道行不行
程序很长,但是没什么复杂的东西。
要是写的不好,楼主就将就吧。
pythonç¼è¾å¨åªä¸ªå¥½
1.PyCharm:PyCharmæ¯JetBrainså¼åçPython IDEãPyCharmç¨äºä¸è¬IDEå ·å¤çåè½ï¼æ¯å¦ï¼ è°è¯ãè¯æ³é«äº®ãProject管çã代ç 跳转ãæºè½æ示ãèªå¨å®æãåå æµè¯ãçæ¬æ§å¶â¦â¦å¦å¤ï¼PyCharmè¿æä¾äºä¸äºå¾å¥½çåè½ç¨äºDjangoå¼åï¼åæ¶æ¯æGoogle App Engineï¼æ´é ·çæ¯ï¼PyCharmæ¯æIronPythonï¼
2.Eclipse + PyDev:
ä¾é 强大çeclipseï¼PyDevæ¾å¾æ ¼å¤èç¼ã强大çè°è¯åè½åèæçç¼è¾ç¯å¢è®©PyDevèµ¢å¾äºè®¸å¤äººçéçãä¸è¿eclipseæ¬æ¥å°±æ¯èèµæºå¤§æ·ï¼PyDevå¨è¿ä¸ç¹ä¸æ¯«æ åæ³ï¼ä½ç°å¨ççµèé½å¾å¿«äºï¼è·eclipseæ ¹æ¬å°±æ¯å°caseï¼ä¸ç¨æ å¿å¤ªå¤ãé¤äºå¼ºå¤§çè°è¯åè½ï¼ä¾é eclipseï¼PyDevç代ç æµè§è½åæ¯å ¶å®ææIDEæä¸è½æ¯çï¼æ¯å¦æä½CTRLé®åç¹å»ä¸ä¸ªç±»å°±è½èªå¨è·³å°è¯¥ç±»çå®ä¹ï¼è¿å¯¹äºé 读代ç é常æç¨ãç°å¨PyDev extensionä¹å¼æºäºï¼æ以ä¸äº(æä¸ç¥éç)é«çº§çåè½ä¹è¢«èå ¥å°PyDevéäºã
3.Visual Studio + PTVS:
ä¼æå¨ç¥ï¼Visual Studioæ¯å¼åWindowså¹³å°äº§åçå©å¨ï¼æ¯C#ãASP.NETçåºç¨å¼åçé¦é IDEãå ¶å®ï¼Visual Studioä¹å¯ä½ä¸ºPython IDEæ¥ä½¿ç¨ãä½ åªéå¨Visual Studioçåºç¡ä¸ï¼å®è£ PTVS(Python Tools for Vistul Studio)æ件ï¼å³å¯å¿«éå°Visual StudioåæPython IDEæ¥ä½¿ç¨ã
4.Ulipad:
Ulipadæ¯ä¸ä¸ªå½äººlimodouç¼åçä¸ä¸Pythonç¼è¾å¨ï¼å®åºäºwxpythonå¼åçGUI(å¾å½¢åçé¢)ï¼å身æ¯NewEditï¼æèªå¨è¡¥å ¨åè½ï¼å¾æ¹ä¾¿ï¼ä¸è¿æ²¡ææçé¢è®¾è®¡å¨wxGladeéæè¿æ¥ãå¼æºï¼å¯ä»¥ç¨SVNä¸è½½å°ææ°çæºä»£ç ï¼ä¾èµwxPythonã轻便å°å·§èåè½å¼ºå¤§ï¼é常éååå¦è ã
5.Spyder:
Spyder(å°±æ¯åæ¥èåçPydee)æ¯ä¸ä¸ªå¼ºå¤§ç交äºå¼Pythonè¯è¨å¼åç¯å¢ï¼å±äºpython(x,y)çä¸é¨åï¼å®æ´çpython(x,y)æå¤Mï¼éæäºç§å¦è®¡ç®å¸¸ç¨çpython第ä¸æ¹åºãæä¾é«çº§ç代ç ç¼è¾ã交äºæµè¯ãè°è¯çç¹æ§ï¼æ¯æå æ¬WindowsãLinuxåOS Xç³»ç»ã
6.Sublime Text:
Sublime Textæ¯å¼åè ä¸ææµè¡çç¼è¾å¨ä¹ä¸ï¼å¤åè½ï¼æ¯æå¤ç§è¯è¨ï¼èä¸å¨å¼åè 社åºé常å欢è¿ãSublimeæèªå·±çå 管çå¨ï¼å¼åè å¯ä»¥ä½¿ç¨å®æ¥å®è£ ç»ä»¶ï¼æ件åé¢å¤çæ ·å¼ï¼ææè¿äºé½è½æåä½ çç¼ç ä½éªãSublimeé åä¸æ件ä¹å¯ä»¥æ¯è¾æ¹ä¾¿å°æ建ä¸ä¸ªæ¹ä¾¿ç类似IDEçpythonè°è¯ç¯å¢äºã
以ä¸å°±æ¯Pythonå¼åä¸å¸¸ç¨çå 款å¼åå·¥å ·ã
用Python构建仪表盘应用的最佳工具
为正确的项目选择正确的工具
数据分析的重要部分是沟通,我们需要以一种易于理解的方式来传播信息,以交流,突出显示和可视化关键区域。
仪表板(Dashboard)使您的数据可视化更上一层楼。他们连接了不同的可视化组件,并制作了一个完整而集成的数据可视化故事。Web应用程序仪表板还允许用户与数据进行交互,从而使他们可以查看和调整他们想要的内容。
在Python中创建仪表板从未如此简单。我们有几个仪表板工具可供使用,以制作连贯的数据可视化故事,而无需使用Tableau或Power BI之类的传统仪表板工具。
在本文中,我将列出Python中四种最受欢迎的仪表板工具,我将重点介绍它们的应用场景,功能和学习曲线。
1. Streamlit
您要使用Python快速创建仪表板吗?Streamlit是您的最佳选择。
Streamlit通过易于使用的API和持续的功能开发彻底革新了创建Web应用程序的过程。直到去年月,这个开源工具才被公布,毫无疑问,它在数据科学界的普及迅速增长。
如今,Streamlit通过最近引入的 streamlit component增强了更多功能,开发人员社区在其中添加了新功能。
借助Streamlit的新一键式部署服务(Beta版本),共享和部署Streamlit应用程序也变得非常容易。现在,您可以开发和创建Web应用程序和仪表板,并在数分钟而不是数天的时间内部署它们,这要归功于Streamlit。
我喜欢streamlit的是,它在此列表中具有所有Python Dashboard创建工具中最短的学习曲线。它提供了出色的文档和简单的API,并允许您使用更少的纯Python代码来开发应用程序。
简而言之,Streamlit使您能够专注于重要的事情,而不用考虑要用于项目的前端和后端技术堆栈。
2. Panel
您是否要使用声明式和反应式编程在Pure Python中创建功能强大且高级的仪表板?Panel是您最好的选择。
Panel是一个 开放源代码的Python库,您可以通过将用户定义的小部件连接到绘图,图像,表格或文本来创建自定义的交互式Web应用程序和仪表板。
虽然可以在Jupyter notebook中使用Streamlit,但我们主要使用Python脚本。如果您最喜欢的数据科学工具是Jupyter Notebook,则 Panel为所有绘图库提供广泛的支持。
学习曲线比Streamlit陡峭,但是,使用较少的带有小部件和参数的代码在Panel中创建交互式Web应用程序很简单。
在Panel中部署和共享Web应用程序和仪表板很容易。您可以在Jupyter Notebook中显示仪表板,将其呈现为Ipywidgets,从命令行运行它,或使用诸如Heroku,MyBinder或其他云平台进行部署。
3. Voilà
您想快速将Jupyter Notebook变成独立的Web应用程序吗? Voilà是最好的选择。
Voilà — 带有交互式小部件的实时Jupyter Notebook渲染。
Voilà主要是Jupyter本地渲染工具。但是,您可以使用Ipywidget在Jupyter Notebook中使用小部件创建交互式报告。您还可以使用Viola将笔记本上的所有内容渲染到仪表板中。
快速将Jupyter Notebook部署到仪表板是Voilà的强项,也是其缺点。您可以使用Voilà制作连贯的仪表板,但这需要您在Jupyter Notebook中相应地格式化实验和代码,或者隐藏未使用的代码。
4. Plotly Dash
您是否需要用Python搭建更高级和适用于生产环境的仪表板?Plotly Dash可以满足您的需求。
Plotly Dash专注于生产环境和企业级仪表板的创建,而且还提供Python,R和Julia的开源接口。这是此列表中最成熟的选项。
尽管Dash仅需几个小时即可使用全栈和DevOps工具来构建和部署Web应用程序,但它具有最陡峭的学习曲线。
随着Plotly Express的引入,情况发生了变化 -- 它提供了简单易用的高级API,允许使用Plotly Libary创建图形。Plotly Express库是我最喜欢的Python数据可视化工具之一。
在本地环境中部署Plotly仪表板很容易,如果需要在外部共享它,则需要将其部署到服务器。
仪表板工具的选择取决于您的项目需求。Streamlit是快速创建仪表板应用程序的通用选择,如果您的网页App以数据分析和可视化为核心,它可能是最好的工具。Viola和Panel主要为Jupyter Notebook服务,您可以将它们与您喜欢的任何绘图库结合使用。最后,将Plotly Dash用于创建更高级的仪表板。