《C语言程序设计-班级财务管理系统.doc》由会员分享,可在线阅读,更多相关《C语言程序设计-班级财务管理系统.doc(24页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、- .#include#include#include#includetypedef struct ine_infoint number; double ine; int month; int day; int year; char name50; struct ine_info * next;IneLink,* Pointer1;typedef struct output_infoint number; double output; int month; int day; int year; int use; char name50; struct output_info * next;Ou
2、tputLink,* Pointer2;int Select(void); /收入和支出管理选择函数void Insert1(Pointer1 * Head1);void Insert2(Pointer2 * Head2);void Search1(Pointer1 Head1);void Search2(Pointer2 Head2);void Update1(Pointer1 Head1);void Update2(Pointer2 Head2);void Delete1(Pointer1 *Head1);void Delete2(Pointer2 *Head2); void Show1(
3、Pointer1 Head1);void Show2(Pointer2 Head2); void Count1(Pointer1 Head1);void Count2(Pointer2 Head2);void Save1(Pointer1 Head1);void Save2(Pointer2 Head2);Pointer1 load1();Pointer2 load2();int n,k;int main() void menu1(); void menu2(); char m7;char M7;char num15; int i,j,out; long sum; Pointer1 Head1
4、=NULL; Pointer1 r1,p1; Pointer2 Head2=NULL; Pointer2 r2,p2; FILE *fp1,*fp2;p1=r1=(Pointer1)malloc(sizeof(IneLink); p2=r2=(Pointer2)malloc(sizeof(OutputLink); printf(请输入你的XX(即你的学号):); gets(num); for(i=4;i10;i+) mi-4=numi; m6=0; for(i=0;i=1210315101&sumnumber=in_number) printf(已经有一样的编号:); printf(n按任意键
5、继续!n); getchar();return; elseq=p;p=p-next; r=(Pointer1)malloc(sizeof(IneLink); r-next=NULL; if(r=NULL) printf(分配空间失败n); return; if(q=NULL) *Head1=r; else q-next=r; r-number=in_number; printf(请输入收入金额(单位:元):); scanf(%lf,&r-ine); printf(请输入收入时间:n); printf(年:); scanf(%d,&r-year); printf(月:); scanf(%d,&r
6、-month); printf(日:);scanf(%d,&r-day); printf(请输入您的XX:); scanf(%s,r-name); printf(nnnn); Sleep(300);void Insert2(Pointer2 *Head2) /添加支出 int in_number; Pointer2 p,q,r; printf(请输入编号: ); scanf(%d,&in_number); p=q=*Head2; while(p!=NULL) if(p-number=in_number) printf(已经有一样的编号:); printf(n按任意键继续!n); getchar
7、(); return; elseq=p;p=p-next; r=(Pointer2)malloc(sizeof(IneLink); r-next=NULL; if(r=NULL) printf(分配空间失败n); return; if(q=NULL) *Head2=r; else q-next=r; r-number=in_number; printf(请输入支出金额(单位:元):); scanf(%lf,&r-output); printf(请输入支出时间:n); printf(年:); scanf(%d,&r-year); printf(月:); scanf(%d,&r-month); p
8、rintf(日:); scanf(%d,&r-day); printf(请输入用途:); printf(1:吃喝(eat) n2:娱乐(amusement) n3:学习(studying) n4:其它(other)n); printf(请选择(1-4):n); scanf(%d,&r-use); printf(请输入使用人名称:); scanf(%s,r-name); Sleep(300);void Search1(Pointer1 Head1) /查询收入 int flag=1; int number1; Pointer1 p; printf(请输入查询的编号:); scanf(%d,&nu
9、mber1); p=Head1; while(p!=NULL&flag) if(p-number=number1) printf(收入金额:%lf元n,p-ine); printf(收入时间:n); printf(年:%d,月:%d,日:%dn,p-year,p-month,p-day); printf(XX:%s,p-name); printf(nnnn); getchar(); flag=0; else p=p-next; if(flag) printf(没有查到n); printf(nnnn); getchar();void Search2(Pointer2 Head2) /查询支出 v
10、oid Search_name(Pointer2 Head2); void Search_number(Pointer2 Head2); int i; printf(请选择查询的方式:n); printf(1.XX 2.编号n); scanf(%d,&i); switch(i) case 1: Search_name(Head2); break; case 2: Search_number(Head2); break; Sleep(1000); printf(nnnn); getchar();void Search_name(Pointer2 Head2) /支出查询函数XX int flag
11、=1; char name50; Pointer2 p; printf(请输入查询的XX:); scanf(%s,name); p=Head2; while(p!=NULL&flag) if(strcmp(p-name,name)=0) printf(支出金额:%lf元n,p-output); printf(支出时间:n); printf(年:%d,月:%d,日:%dn,p-year,p-month,p-day); if(p-use=1) printf(用途:吃喝n); else if(p-use=2) printf(用途:娱乐n); else if(p-use=3) printf(用途:学习
12、n); else printf(用途:其它n); printf(使用人XX:%s,p-name); printf(n按任意键继续!n); getchar(); flag=0; else p=p-next; if(flag) printf(没有查到n);void Search_number(Pointer2 Head2) /支出查询函数编号 int flag=1; long number; Pointer2 p; printf(请输入查询的编号:); scanf(%ld,&number); p=Head2; while(p!=NULL&flag) if(p-number=number) prin
13、tf(支出金额:%lf元n,p-output); printf(支出时间:n); printf(年:%d,月:%d,日:%dn,p-year,p-month,p-day); if(p-use=1) printf(用途:吃喝n); else if(p-use=2) printf(用途:娱乐n); else if(p-use=3) printf(用途:学习n); else printf(用途:其它n); printf(使用人XX:%s,p-name); printf(nnnn); getchar(); flag=0; else p=p-next; if(flag) printf(没有查到n);vo
14、id Update1(Pointer1 Head1) /修改收入int flag=1;int number;Pointer1 p;printf(请输入要修改的编号:);scanf(%d,&number);p=Head1;while(p!=NULL&flag)if(p-number=number) printf(请输入新的收入:);scanf(%lf,&p-ine);printf(请输入新的收入时间:n); printf(年:); scanf(%d,&p-year); printf(月:); scanf(%d,&p-month); printf(日:); scanf(%d,&p-day);pri
15、ntf(请输入新的XX:); scanf(%s,p-name);flag=0;printf(记录已修改n);elsep=p-next;if(flag)printf(没有找到要修改的记录!n);Sleep(300);void Update2(Pointer2 Head2) /修改支出int flag=1,b;int number;Pointer2 p;printf(请输入要修改的编号:);scanf(%d,&number);p=Head2;while(p!=NULL&flag)if(p-number=number) printf(请输入新的支出:);scanf(%lf,&p-output);printf(请输入新的支出时间:n); printf(年:); scanf(%d,&p-year); printf(月:); scanf(%d,&p-month); printf(日:); scanf(%d,&p-day); printf(请选择新的用途:); printf(1:吃喝(eat) n2:娱乐(amusement) n3:学习(studing) n4:其它(other)n); printf(请选择(1-4):n); scanf(%d,&b); p