C语言程序设计班级财务管理系统.docx
- 文档编号:4538349
- 上传时间:2022-12-01
- 格式:DOCX
- 页数:12
- 大小:42.27KB
C语言程序设计班级财务管理系统.docx
《C语言程序设计班级财务管理系统.docx》由会员分享,可在线阅读,更多相关《C语言程序设计班级财务管理系统.docx(12页珍藏版)》请在冰豆网上搜索。
C语言程序设计班级财务管理系统
C语言程序设计-班级财务管理系统(总8页)
#include<>
#include<>
#include<>
#include<>
typedefstructincome_info
{intnumber;
doubleincome;
intmonth;
intday;
intyear;
charname[50];
structincome_info*next;
}IncomeLink,*Pointer1;
typedefstructoutput_info
{intnumber;
doubleoutput;
intmonth;
intday;
intyear;
intuse;
charname[50];
structoutput_info*next;
}OutputLink,*Pointer2;
intSelect(void);添加财务信息§§\n");
printf("§§☆2.查询财务信息§§\n");
printf("§§☆3.修改财务信息§§\n");
printf("§§☆4.删除财务信息§§\n");
printf("§§☆5.显示财务信息§§\n");
printf("§§☆6.统计财务信息§§\n");
printf("§§☆7.保存数据§§\n");
printf("§§☆8.读取数据§§\n");
printf("§§☆0.退出系统§§\n");
printf("§§§§\n");
printf("★**************************************************************★\n");
printf("◆请选择(0-8):
\n");
}
voidmenu2()
{printf("★**************************************************************★\n");
printf("§*******************★欢迎使用财务管理系统★*******************§\n");
printf("§**************************************************************§\n");
printf("§§§§\n");
printf("§§☆1.添加财务信息§§\n");
printf("§§☆2.查询财务信息§§\n");
printf("§§☆3.显示财务信息§§\n");
printf("§§☆4.统计财务信息§§\n");
printf("§§☆5.保存数据§§\n");
printf("§§☆6.读取数据§§\n");
printf("§§☆0.退出系统§§\n");
printf("§§§§\n");
printf("★**************************************************************★\n");
printf("◆请选择(0-6):
\n");
}
intSelect(void)收入§§\n");
printf("§§☆2.支出§§\n");
printf("§§§§\n");
printf("★**************************************************************★\n");
printf("◆◆◆请选择(1-2):
\n");
scanf("%d",&w);
return(w);
}
voidInsert1(Pointer1*Head1)名2.编号\n");
scanf("%d",&i);
switch(i)
{
case1:
Search_name(Head2);
break;
case2:
Search_number(Head2);
break;
}
Sleep(1000);
printf("\n\n\n\n");
getchar();
}
voidSearch_name(Pointer2Head2)用途2.按时间\n");
scanf("%d",&i);
switch(i)
{
case1:
Counter_use(Head2);
break;
case2:
Counter_time(Head2);
break;
default:
printf("错误选择!
\n");break;
}
Sleep(1000);
printf("\n按任意键继续!
\n");
getchar();
}
voidCounter_use(Pointer2Head2)//按用途统计支出
{intb;
Pointer2p;
doublesum1,sum2,sum3,sum4;
sum1=sum2=sum3=sum4=;
p=Head2;
while(p!
=NULL)
{if(p->use==1)
sum1=sum1+p->output;
elseif(p->use==2)
sum2=sum2+p->output;
elseif(p->use==3)
sum3=sum3+p->output;
else
sum4=sum4+p->output;
p=p->next;
}
printf("请选择您要统计的用途:
");
printf("<1:
吃喝2:
娱乐3:
学习4:
其它>\n");
printf("◆请选择(1-4):
\n");
scanf("%d",&b);
switch(b)
{case1:
printf("在该用途上的支出为:
%lf\n",sum1);break;
case2:
printf("在该用途上的支出为:
%lf\n",sum2);break;
case3:
printf("在该用途上的支出为:
%lf\n",sum3);break;
case4:
printf("在该用途上的支出为:
%lf\n",sum4);break;
default:
printf("错误选择!
\n");break;
}
}
voidCounter_time(Pointer2Head2)//按时间统计支出
{intj;
intb;
Pointer2p;
doublesum1,sum2,sum3,sum4,sum5,sum6,sum7,sum8,sum9,sum10,sum11,sum12;
sum1=sum2=sum3=sum4=sum5=sum6=sum7=sum8=sum9=sum10=sum11=sum12=;
p=Head2;
while(p!
=NULL)
{switch(p->month)
{case1:
sum1=sum1+p->output;break;
case2:
sum2=sum2+p->output;break;
case3:
sum3=sum3+p->output;break;
case4:
sum4=sum4+p->output;break;
case5:
sum5=sum5+p->output;break;
case6:
sum6=sum6+p->output;break;
case7:
sum7=sum7+p->output;break;
case8:
sum8=sum8+p->output;break;
case9:
sum9=sum9+p->output;break;
case10:
sum10=sum10+p->output;break;
case11:
sum11=sum11+p->output;break;
case12:
sum12=sum12+p->output;break;
default:
printf("错误选择!
\n");break;
}
p=p->next;
}
printf("请输入您要统计的月份:
");
scanf("%d",&j);
switch(j)
{case1:
printf("该月份总计为:
%lf\n",sum1);break;
case2:
printf("该月份总计为:
%lf\n",sum2);break;
case3:
printf("该月份总计为:
%lf\n",sum3);break;
case4:
printf("该月份总计为:
%lf\n",sum4);break;
case5:
printf("该月份总计为:
%lf\n",sum5);break;
case6:
printf("该月份总计为:
%lf\n",sum6);break;
case7:
printf("该月份总计为:
%lf\n",sum7);break;
case8:
printf("该月份总计为:
%lf\n",sum8);break;
case9:
printf("该月份总计为:
%lf\n",sum9);break;
case10:
printf("该月份总计为:
%lf\n",sum10);break;
case11:
printf("该月份总计为:
%lf\n",sum11);break;
case12:
printf("该月份总计为:
%lf\n",sum12);break;
default:
printf("错误选择!
\n");break;
}
printf("请输入您要统计的学期:
\n");
printf("<1:
上学期2:
下学期3:
退出>\n");
printf("◆请选择(1-3):
\n");
scanf("%d",&b);
switch(b)
{case1:
printf("上学期的总计为:
%lf\n",sum2+sum3+sum4+sum5+sum6+sum7);break;
case2:
printf("上学期的总计为:
%lf\n",sum1+sum8+sum9+sum10+sum11+sum12);break;
case3:
break;
default:
printf("错误选择!
\n");break;
}
}
voidSave1(Pointer1Head1)//存档收入文件
{FILE*fp;
Pointer1p;
intcount=0;
fp=fopen("c:
\\","wb");
if(fp==NULL)
{printf("\n=====>打开文件失败!
!
!
!
\n");
getchar();
return;
}
p=Head1;
while(p)
{if(fwrite(p,sizeof(IncomeLink),1,fp)==1)
{p=p->next;
count++;
}
else
break;
}
if(count>0)
{getchar();
printf("\n\n\n\n\n=====>保存文件完毕");
getchar();
}
else
{system("cls");
printf("没有可以存档的数据\n请重输!
!
!
\n");
}
fclose(fp);
}
voidSave2(Pointer2Head2)//存档支出文件
{FILE*fp;
Pointer2p;
intcount=0;
fp=fopen("c:
\\","wb");
if(fp==NULL)
{printf("\n=====>打开文件失败!
!
!
!
\n");
getchar();
return;
}
p=Head2;
while(p)
{if(fwrite(p,sizeof(OutputLink),1,fp)==1)
{p=p->next;
count++;
}
else
break;
}
if(count>0)
{getchar();
printf("\n\n\n\n\n=====>保存文件完毕");
getchar();
}
else
{system("cls");
printf("没有可以存档的数据\n请重输!
!
!
\n");
}
fclose(fp);
}
Pointer1load1()//读取收入
{
intj;
Pointer1p,q,h=NULL;
FILE*fp1;
if((fp1=fopen("c:
\\","rb"))==NULL)
{
printf("文件打开失败\n");
for(j=0;j<;j++);
exit(0);
}
/*printf("-----------------@@正在打开文件@@------------------\n");*/
p=(Pointer1)malloc(sizeof(IncomeLink));
if(!
p)
{
printf("内存溢出");
returnh;
}
h=p;
while(!
feof(fp1))
{
if(1!
=fread(p,sizeof(IncomeLink),1,fp1))
break;
p->next=(Pointer1)malloc(sizeof(IncomeLink));
if(!
p->next)
{
printf("内存溢出\n");
returnh;
}
q=p;
p=p->next;
}
q->next=NULL;
fclose(fp1);
printf("--------------你成功地从文件读入数据---------------\n");
printf("***********************************************************************\n");
for(j=0;j<9;j++);
returnh;
}
Pointer2load2()//读取支出
{
intj;
Pointer2p,q,h=NULL;
FILE*fp2;
if((fp2=fopen("c:
\\","rb"))==NULL)
{
printf("文件打开失败\n");
for(j=0;j<;j++);
exit(0);
}
/*printf("-----------------@@正在打开文件@@------------------\n");*/
p=(Pointer2)malloc(sizeof(OutputLink));
if(!
p)
{
printf("内存溢出");
returnh;
}
h=p;
while(!
feof(fp2))
{
if(1!
=fread(p,sizeof(OutputLink),1,fp2))
break;
p->next=(Pointer2)malloc(sizeof(OutputLink));
if(!
p->next)
{
printf("内存溢出\n");
returnh;
}
q=p;
p=p->next;
}
q->next=NULL;
fclose(fp2);
printf("--------------你成功地从文件读入数据---------------\n");
printf("***********************************************************************\n");
for(j=0;j<9;j++);
returnh;
}
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言程序设计 班级 财务管理 系统
![提示](https://static.bdocx.com/images/bang_tan.gif)