C语言课程设计——家庭财务管理系统.txt
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
#include <conio.h>
#define maxsize 2000 //定义家庭成员最大人数
#define maxinfor 20000 //定义收支信息的最大容量
struct people //家庭成员登录信息结构
{
char username[200]; //用户名(也是姓名)
char code[200]; //密码
char flag[200]; //标志 0为普通成员,1为家长
}peo[maxsize];
struct thing //成员收支信息结构
{
char name[30]; //姓名
int year; //年份
int month; //月份
int income; //收入
int output; //支出
}thi[maxinfor];
int n=0,m=0; //全局变量 n为文件中家庭成员实际容量 m为文件中收支信息实际容量 int hold() //将数据写进文件中
{
FILE *fp;
int i;
fp=fopen("peoplelist4.txt","w");
{
fprintf(fp,"%d\n",n);
for(i=0;i<n;i++)
fprintf(fp,"%s %s %s\n",peo[i].username,peo[i].code,peo[i].flag); }
fclose(fp);
fp=fopen("thinglist4.txt","w");
{
fprintf(fp,"%d\n",m);
for(i=0;i<m;i++)
fprintf(fp,"%s %d %d %d %d\n",thi[i].name,thi[i].year,thi[i].month,thi[i].income,thi[i].output);
}