1 / 11
文档名称:

C语言程序设计物业管理系统.pdf

格式:pdf   大小:267KB   页数:11页
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

C语言程序设计物业管理系统.pdf

上传人:2210620458 9/23/2022 文件大小:267 KB

下载得到文件列表

C语言程序设计物业管理系统.pdf

相关文档

文档介绍

文档介绍:该【C语言程序设计物业管理系统 】是由【2210620458】上传分享,文档一共【11】页,该文档可以免费在线阅读,需要了解更多关于【C语言程序设计物业管理系统 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。:.
#include""
#include""
#include""
#defineM5
structPeople
{
inta;
charming[30];
charxiang[30];
intb;
intc;
}P[M];
voidmain()
{
inta=1;
voidmenu_1(inta);
menu_1(a);
}
voidmenu_1(inta)
{
voidmenu_2();
voidmenu_3();
voidbiao_1();
intloop=1;
while(loop)
{
system("cls");
printf("\tWELCOME\n");
printf("\t--------------------(*^◎^*)--------------------\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");:.
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t-------------------o(╯□╰)o-------------------\n");
printf("\tEND\n");
printf("请输入所要选择内容的序号(1-4):[]\b\b");
scanf("%d",&a);
switch(a)
{
case1:menu_2();break;
case2:menu_3();break;
case3:biao_1();break;
case4:exit(0);break;
default:exit(0);
}
getchar();
getchar();
}
}
voidmenu_2()
{
voidscan_1();
voidadd_1();
voidrewrite_1();
voiddelete_1();
voidseek_1();
inta;
system("cls");
printf("\t*欢迎使用小区用户管理系统*\n");
printf("\t-----------------↖(^ω^)↗---------------------\n");
printf("\t--\n");
printf("\t--\n");:.
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t-----------------O(∩_∩)O~---------------------\n");
printf("\tEND\n");
printf("请输入所要选择内容的序号(1-3):[]\b\b");
scanf("%d",&a);
switch(a)
{
case1:scan_1();break;
case2:add_1();break;
case3:rewrite_1();break;
case4:delete_1();break;
case5:seek_1();break;
default:exit(0);
}
}
voidscan_1()
{
FILE*fp;
charch;
if((fp=fopen("e:\","r+"))==NULL)
{
printf("cannotopenthefile!");
exit(0);
}
ch=fgetc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
fclose(fp);
printf("\n");:.
}
voidadd_1()
{
FILE*fp;
if((fp=fopen("e:\","a"))==NULL)
{
printf("文件不能打开/n");
exit(0);
}
else
{
inti;intnum;
printf("输入所要输入数据的数目=");
scanf("%d",&num);
for(i=2;i<num+2;i++)
{
printf("编号:");
scanf("%d",&P[i].a);
printf("姓名:");
scanf("%s",P[i].ming);
printf("项目:");
scanf("%s",P[i].xiang);
printf("已交:");
scanf("%d",&P[i].b);
printf("已欠:");
scanf("%d",&P[i].c);
fprintf(fp,"%d%s%s%d%d",P[i].a,P[i].ming,P[i].xiang,P[i].b,P[i].c);
fprintf(fp,"\n");
}
fclose(fp);
}
}
voidsavein_1():.
{
inti;
FILE*fp;
fp=fopen("e:\","r");
for(i=0;i<3;i++)
fscanf(fp,"%d%s%s%d%d",&P[i].a,P[i].ming,P[i].xiang,&P[i].b,&P[i].c);
fclose(fp);
}
voidrewrite_1()
{
FILE*fp;
voidsavein_1();
if((fp=fopen("e:\","a"))==NULL)
{
printf("文件不能打开/n");
exit(0);
}
else
{
inti=0,num;
savein_1();
printf("输入所要更改的编号[]\b\b");
scanf("%d",&num);
while(P[i].a!=num)
i++;
printf("请输入所要的新标号\n");
scanf("%d",&P[i-1].a);
printf("请输入所要的姓名\n");
scanf("%s",P[i-1].ming);
printf("请输入所要的收费项目\n");
scanf("%s",P[i-1].xiang);
printf("请输入所欠的物业费\n");
scanf("%d",&P[i-1].b);
printf("请输入已交的物业费\n");
scanf("%d",&P[i-1].c);
fp=fopen("e:\","w+");
i=0;
do:.
{
fprintf(fp,"%d%s%s%d%d",P[i].a,P[i].ming,P[i].xiang,P[i].b,P[i].c);
i++;
}while(i<=2);
fclose(fp);
}
}
voiddelete_1()
{
FILE*fp;
voidsavein_1();
intnum,i=0;
printf("请输入所要删除人的编号:[]\b\b");
scanf("%d",&num);
savein_1();
while(P[i].a!=num)
i++;
for(i;i<=5;i++)
{
P[i].a=P[i+1].a;
strcpy(P[i].ming,P[i+1].ming);
strcpy(P[i].xiang,P[i+1].xiang);
P[i].b=P[i+1].b;
P[i].c=P[i+1].c;
}
fp=fopen("e:\","w");
i=0;
do
{
fprintf(fp,"%d%s%s%d%d",P[i].a,P[i].ming,P[i].xiang,P[i].b,P[i].c);
i++;
}while(i<=5);
fclose(fp);
}
:.
voidseek_1()
{
voidsavein_1();
intnum,i=0;
printf("请输入所要查找的人的编号:[]\b\b");
scanf("%d",&num);
savein_1();
while(i!=num)
i++;
printf("%d%s%s%d%d",P[i-1].a,P[i-1].ming,P[i-1].xiang,P[i-1].b,P[i-1].c);
}
voidmenu_3()
{
voidscan_2();
voidadd_2();
voidrewrite_1();
voiddelete_2();
inta;
system("cls");
printf("\t*欢迎使用物业收费管理系统*\n");
printf("\t------------------(⊙_⊙?)----------------------\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t--\n");
printf("\t-------------------(⊙o⊙)----------------------\n");
printf("\t-END-\n");
printf("请输入所要选择内容的序号(1-3):[]\b\b");
scanf("%d",&a);
switch(a)
{
case1:scan_2();break;:.
case2:add_2();break;
case3:rewrite_1();break;
case4:delete_2();break;
default:exit(0);
}
}
voidscan_2()
{
FILE*fp;
charch;
if((fp=fopen("e:\","r+"))==NULL)
{
printf("cannotopenthefile!");
exit(0);
}
ch=fgetc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
fclose(fp);
}
voidadd_2()
{
inti,num;
FILE*fp;
if((fp=fopen("e:\","a"))==NULL)
{
printf("文件不能打开/n");
exit(0);:.
}
else
{
printf("输入所要输入数据的数目=");
scanf("%d",&num);
for(i=3;i<num+3;i++)
{
printf("编号:");
scanf("%d",&P[i].a);
printf("姓名:");
scanf("%s",&P[i].ming);
printf("项目:");
scanf("%s",&P[i].xiang);
printf("已交:");
scanf("%d",&P[i].b);
printf("已欠:");
scanf("%d",&P[i].c);
fprintf(fp,"%d%s%s%d%d",P[i].a,P[i].ming,P[i].xiang,P[i].b,P[i].c);
}
fclose(fp);
printf("\n");
}
}
/*voidrewrite_2()
{
FILE*fp;
if((fp=fopen("e:\","w"))==NULL)
{
printf("文件不能打开/n");
exit(0);
}
else
{inti,num;
printf("输入所要输入数据的数目=");
scanf("%d",&num);
for(i=3;i<num+3;i++)
{
printf("项目:");
scanf("%s",&P[i].xiang);
fprintf(fp,"%s",P[i].xiang);
fprintf(fp,"\n");
}
fclose(fp);:.
}
}
*/
voiddelete_2(intd)
{
FILE*fp;
voidsavein_1();
intnum,i=0;
printf("请输入所要删除人的编号:[]\b\b");
scanf("%d",&num);
savein_1();
while(i!=num)
i++;
for(i=num;;i++)
{
P[i].a=P[i+1].a;
strcpy(P[i].ming,P[i+1].ming);
strcpy(P[i].xiang,P[i+1].xiang);
P[i].b=P[i+1].b;
P[i].b=P[i+1].b;
}
fp=fopen("e:\","a");
do
{
i=0;
fprintf(fp,"%d%s%s%d%d",P[i].a,P[i].ming,P[i].xiang,P[i].b,P[i].c);
i++;
}while(i<=5);
fclose(fp);
}
voidbiao_1()
{
FILE*fp;
charch;
if((fp=fopen("e:\","r+"))==NULL)
{:.
printf("cannotopenthefile!");
exit(0);
}
ch=fgetc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
fclose(fp);
printf("\n");
}