欢迎来到天天文库
浏览记录
ID:20866947
大小:71.00 KB
页数:20页
时间:2018-10-17
《c语言课程设计——家庭财务管理系统》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、C语言课程设计——家庭财务管理系统.txt#include#include#include#include#definemaxsize2000//定义家庭成员最大人数#definemaxinfor20000//定义收支信息的最大容量structpeople//家庭成员登录信息结构{charusername[200];//用户名(也是姓名)charcode[200];//密码charflag[200];//标志0为普通成员,1为家长}peo[maxsize];struct
2、thing//成员收支信息结构{charname[30];//姓名intyear;//年份intmonth;//月份intincome;//收入intoutput;//支出}thi[maxinfor];intn=0,m=0;//全局变量n为文件中家庭成员实际容量m为文件中收支信息实际容量inthold()//将数据写进文件中{FILE*fp;inti;fp=fopen("peoplelist4.txt","w");{fprintf(fp,"%d",n);for(i=0;i3、.username,peo[i].code,peo[i].flag);}fclose(fp);fp=fopen("thinglist4.txt","w");{fprintf(fp,"%d",m);for(i=0;i4、n("peoplelist4.txt","r"))!=NULL){fscanf(fp,"%d",&n);for(i=0;i5、thi[i].month,&thi[i].income,&thi[i].output);}fclose(fp);return0;}intmaster()//初始化家长{carry();if(n==0){strcpy(peo[n].username,"小明");strcpy(peo[n].code,"2010");strcpy(peo[n].flag,"1");n++;}hold();return0;}intadd_people()//增加新的家庭成员{intj=1,i,q=100,m=3;carry();printf("【添加新成员】6、n");printf("请输入新成员姓名:");scanf("%s",peo[n].username);for(i=0;i7、g);if(strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0){printf("输入格式错误,请重新输入1或者0!!");}for(i=0;strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0;i++){if(i!=0){printf("输入格式错误,请重新输入1或者0!!");}printf("新成员是否作为家长(是请输入1,否输入0):");scanf("%s",peo[n].flag);}n++;hold()8、;printf("添加新成员成功。");}return0;}intadd_thing()//录入成员收支信息{intk=3,i,p=1;cha
3、.username,peo[i].code,peo[i].flag);}fclose(fp);fp=fopen("thinglist4.txt","w");{fprintf(fp,"%d",m);for(i=0;i4、n("peoplelist4.txt","r"))!=NULL){fscanf(fp,"%d",&n);for(i=0;i5、thi[i].month,&thi[i].income,&thi[i].output);}fclose(fp);return0;}intmaster()//初始化家长{carry();if(n==0){strcpy(peo[n].username,"小明");strcpy(peo[n].code,"2010");strcpy(peo[n].flag,"1");n++;}hold();return0;}intadd_people()//增加新的家庭成员{intj=1,i,q=100,m=3;carry();printf("【添加新成员】6、n");printf("请输入新成员姓名:");scanf("%s",peo[n].username);for(i=0;i7、g);if(strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0){printf("输入格式错误,请重新输入1或者0!!");}for(i=0;strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0;i++){if(i!=0){printf("输入格式错误,请重新输入1或者0!!");}printf("新成员是否作为家长(是请输入1,否输入0):");scanf("%s",peo[n].flag);}n++;hold()8、;printf("添加新成员成功。");}return0;}intadd_thing()//录入成员收支信息{intk=3,i,p=1;cha
4、n("peoplelist4.txt","r"))!=NULL){fscanf(fp,"%d",&n);for(i=0;i5、thi[i].month,&thi[i].income,&thi[i].output);}fclose(fp);return0;}intmaster()//初始化家长{carry();if(n==0){strcpy(peo[n].username,"小明");strcpy(peo[n].code,"2010");strcpy(peo[n].flag,"1");n++;}hold();return0;}intadd_people()//增加新的家庭成员{intj=1,i,q=100,m=3;carry();printf("【添加新成员】6、n");printf("请输入新成员姓名:");scanf("%s",peo[n].username);for(i=0;i7、g);if(strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0){printf("输入格式错误,请重新输入1或者0!!");}for(i=0;strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0;i++){if(i!=0){printf("输入格式错误,请重新输入1或者0!!");}printf("新成员是否作为家长(是请输入1,否输入0):");scanf("%s",peo[n].flag);}n++;hold()8、;printf("添加新成员成功。");}return0;}intadd_thing()//录入成员收支信息{intk=3,i,p=1;cha
5、thi[i].month,&thi[i].income,&thi[i].output);}fclose(fp);return0;}intmaster()//初始化家长{carry();if(n==0){strcpy(peo[n].username,"小明");strcpy(peo[n].code,"2010");strcpy(peo[n].flag,"1");n++;}hold();return0;}intadd_people()//增加新的家庭成员{intj=1,i,q=100,m=3;carry();printf("【添加新成员】
6、n");printf("请输入新成员姓名:");scanf("%s",peo[n].username);for(i=0;i7、g);if(strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0){printf("输入格式错误,请重新输入1或者0!!");}for(i=0;strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0;i++){if(i!=0){printf("输入格式错误,请重新输入1或者0!!");}printf("新成员是否作为家长(是请输入1,否输入0):");scanf("%s",peo[n].flag);}n++;hold()8、;printf("添加新成员成功。");}return0;}intadd_thing()//录入成员收支信息{intk=3,i,p=1;cha
7、g);if(strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0){printf("输入格式错误,请重新输入1或者0!!");}for(i=0;strcmp(peo[n].flag,"1")!=0&&strcmp(peo[n].flag,"0")!=0;i++){if(i!=0){printf("输入格式错误,请重新输入1或者0!!");}printf("新成员是否作为家长(是请输入1,否输入0):");scanf("%s",peo[n].flag);}n++;hold()
8、;printf("添加新成员成功。");}return0;}intadd_thing()//录入成员收支信息{intk=3,i,p=1;cha
此文档下载收益归作者所有