【最新+免费】模拟IP话费管理系统
【最新编排】
----------------------------------------------------------------------------------------------------------------------
#include #include
#include
struct Info
{
char name????????;
char number????0??;
};
struct Rec
{
int minute,second;
int h,m,s;
char num??????9??,num??????9??;
double local,toll,total;
char type????0??;
};
typedef struct Info Info; typedef struct Rec Rec; struct node
{
char name????0??;
char number????0??;
struct node *next;
};
void Input()
//??3/4"?...???"??????????????????/?????ã
{
FILE *fp;
Rec temp;
int i,flag=??,flag??;
char s??8??="??795??";
char a??4??="00??";
char au??4??="06??";
char f??5??="0033";
fp=fopen("?????????oa???/???.txt","a");
if(!fp)
{
printf("file cannot be opened!");
return ;
}
printf("Input minute,second:");
scanf("%d%d",&temp.minute,&temp.second);
if(temp.second)
{
temp.second=0;
temp.minute++;
}
printf("Input call number(IP????-??o????-?"?Ì?????????? ?):");
scanf("%s",temp.num??);
printf("Input reply number(IP????-??o????-?"?Ì?????????? ?):");
scanf("%s",temp.num??);
for (i=0;i<5;i++)
if(temp.num????i??!=s??i??)
flag=0;
if(flag==0)
{
strcpy(temp.type,"??????ã???????????(r)?ã???/???");
if(temp.minute<=3)
{
temp.local=0.5;
temp.toll=0;
}
else if(temp.minute>3)
{
temp.local=0.??*temp.minute-0.??;
temp.toll=0;
}
temp.total=temp.local+temp.toll;
}
else
{
strcpy(temp.type,"IP???????"???????????(r)?ã???/???");
if(temp.minute<=3)
temp.local=0.5;
else if(temp.minute>3)
temp.local=0.??*temp.minute-0.??;
for(i=0;i<3&&a??i??==temp.num????i+6??;i++)flag??=??;
for(i=0;i<3&&au??i??==temp.num????i+6??;i++)flag??=??;
for(i=0;i<4&&f??i??==temp.num????i+6??;i++)flag??=3;
switch(flag??)
{
case ??:temp.toll=temp.minute*??.??;break;
case ??:temp.toll=temp.minute*??.0;break;
case 3:temp.toll=temp.minute*??.5;break;
}
temp.total=temp.toll+temp.local;
}
printf("Input call time:");
scanf("%d%d%d",&temp.h,&temp.m,&temp.s);
fprintf(fp,"%s%??0s%5d%??5s%3d:%3d:%3d%6g%3g%3g\n",temp.num??,temp.num??,temp.minute,temp.type,temp.h,temp.m,temp.s,temp.local,temp.toll,temp.total);
fclose(fp);
}
void calldetail() //?????????é????????????"?????/?????ã
{
FILE *fp;
Rec temp;
char number????0??;
int k=0;
fp=fopen("?????????oa???/???.txt","r");
if(!fp)
{
printf("file cannot be opened!");
return ;
}
printf("Input user's number:\n");
scanf("%s",&number);
fscanf(fp,"%s%s%d%s%d:%d:%d%lf%lf%lf",&temp.num??,&temp.num??,&temp.minute,&temp.type,&temp.h,&temp.m,&temp.s,&temp.local,&temp.toll,&temp.total);
while(!feof(fp))
{
if(!strcmp(number,temp.num??))
{
k++;
fprintf(stdout,"??"??"????? ?:%s???é"??"????? ?:%??0s??????????-?????:%5d???????????À"???%??5s??????????-???-?ä:%3d:%3d:%3d\n",te
mp.num??,temp.num??,temp.minute,temp.type,temp.h,temp.m,temp.s);
}
fscanf(fp,"%s%s%d%s%d:%d:%d%lf%lf%lf",&temp.num??,&temp.num??,&temp.minute,&temp.type,&temp.h,&temp.m,&temp.s,&temp.local,&temp.toll,&temp.total);
}
if(!k)
printf("\n???????????Ì*???/4???????????(r)?ã???/?????-???????ë?-?è
?oo??"??(r)?ã???/??????\n");
fclose(fp);
}
void InputInfo()
//??3/4"?...???"?????????Ì"?-(tm)????/?????ã {
FILE *fp;
Info temp;
fp=fopen("?"?????????Ì"?-(tm).txt","a+");
printf("Input user's name:");
scanf("%s",temp.name);
printf("Input user's number:");
scanf("%s",temp.number);
fprintf(fp,"%s %s\n",temp.name,temp.number);
fclose(fp);
}
void callfare()
//?????????é?"??????????????????/?????ã {
FILE *fp;
char number????0??;
int k=0;
Info temp??;
Rec temp;
double sum=0;
fp=fopen("?"?????????Ì"?-(tm).txt","r+");
if(!fp)
{
printf("file cannot be opened!");
}
printf("Input user's number:\n");
scanf("%s",&number);
fscanf(fp,"%s %s",&temp??.name,&temp??.number);
while(!feof(fp))
{
if(!strcmp(number,temp??.number))
{
fprintf(stdout,"?"????????ì"???:%s?"??????????? ?:%s\n",temp??.name,temp??.number);
k++;
}
fscanf(fp,"%s %s",&temp??.name,&temp??.number);
}
if(!k)
printf("???????????Ì*???/4??"?????????Ì"?-(tm)??-???????ë?-?è?oo??"??(r)?ã???/???.\n");
fclose(fp);
k=0;
fp=fopen("?????????oa???/???.txt","r");
if(!fp)
{
printf("file cannot be opened!");
return ;
}
fscanf(fp,"%s%s%d%s%d:%d:%d%lf%lf%lf",&temp.num??,&temp.num??,&temp.minute,&temp.type,&temp.h,&temp.m,&temp.s,&temp.local,&temp.toll,&temp.total);
while(!feof(fp))
{
if(!strcmp(number,temp.num??))
{
k++;
fprintf(stdout,"??????ã????????ä??:%g???????"????????ä??:%g\n",tem
p.local,temp.toll);
sum+=temp.total;
}
fscanf(fp,"%s%s%d%s%d:%d:%d%lf%lf%lf",&temp.num??,&temp.num??,&temp.minute,&temp.type,&temp.h,&temp.m,&temp.s,&temp.local,&temp.toll,&temp.total);
}
if(!k)
printf("\n???????????Ì*???/4???????????(r)?ã???/?????-???????ë?-?è?oo??"??(r)?ã???/???.\n");
else
printf("????????ä????"???é?:%g\n",sum);
fclose(fp);
}
void modify()
//??(r)?"???"?????????Ì"?-(tm)????/?????ã {
FILE *fp;
struct node *head,*tail,*p;
Info temp;
int size;
char number????0??;
head=NULL;
tail=NULL;
p=NULL;
size=sizeof(struct node);
fp=fopen("?"?????????Ì"?-(tm).txt","r");
fscanf(fp,"%s %s",&temp.name,&temp.number);
while(!feof(fp))
{
p=(struct node *)malloc(size);
strcpy(p->name,temp.name);
strcpy(p->number,temp.number);
fprintf(stdout,"%s %s\n",p->name,p->number);
p->next=NULL;
if(head==NULL)
head=p;
else
tail->next=p;
tail=p;
fscanf(fp,"%s %s",&temp.name,&temp.number);
}
fclose(fp);
p=head;
printf("Input origin user's number\n");
scanf("%s",number);
for(;p&&strcmp(p->number,number);p=p->next);
if(p!=NULL)
{
printf("Input new user's name:\n");
scanf("%s",temp.name);
printf("Input new user's number:\n");
scanf("%s",temp.number);
strcpy((*p).name,temp.name);
strcpy((*p).number,temp.number);
}
else
printf("?"?????????Ì"?-(tm)??-???????ë?-?è?oo??"??(r)?ã???/???.
\n");
fp=fopen("?"?????????Ì"?-(tm).txt","w");
for(p=head;p;p=p->next)
fprintf(fp,"%s %s\n",p->name,p->number);
fclose(fp);
free(p);
}
void deleteinfo()
//?? ??(tm)?è?"?????????Ì"?-(tm)????/?????ã {
FILE *fp;
struct node *head,*tail,*p,*q;
Info temp;
int size;
char number????0??;
head=NULL;
tail=NULL;
p=NULL;
q=NULL;
size=sizeof(struct node);
fp=fopen("?"?????????Ì"?-(tm).txt","r");
fscanf(fp,"%s %s",&temp.name,&temp.number);
while(!feof(fp))
{
p=(struct node *)malloc(size);
strcpy(p->name,temp.name);
strcpy(p->number,temp.number);
fprintf(stdout,"%s %s\n",p->name,p->number);
p->next=NULL;
if(head==NULL)
head=p;
else
tail->next=p;
tail=p;
fscanf(fp,"%s %s",&temp.name,&temp.number);
}
fclose(fp);
p=head;
printf("Input number to be deleted\n");
scanf("%s",number);
for(;p&&strcmp(p->number,number);p=p->next)
q=p;
if(p!=NULL)
{
q->next=p->next;
}
else
printf("?"?????????Ì"?-(tm)??-???????ë?-?è?oo??"??(r)?ã???/???.
\n");
fp=fopen("?"?????????Ì"?-(tm).txt","w");
for(p=head;p;p=p->next)
fprintf(fp,"%s %s\n",p->name,p->number);
fclose(fp);
free(p);
}
void menu()
//??"???????????/?????ã
{
printf("**********0.??????o **********\n");
printf("**********??.??3/4"?...???"?????????Ì"?-(tm) **********\n");
printf("**********??.??3/4"?...?????????????Ì"??(r)?ã???/???***
*******\n");
printf("**********3.?????????é????????ä?? **********\n");
printf("**********4.?????????é????????ä??????"? **********\n");
printf("**********5.??(r)?"???"????????????? **********\n");
printf("**********6.?? ??(tm)?è?"????????????? **********\n");
}
int main()
{
int choice;
do
{
menu();
printf("please Input your choice:\n");
scanf("%d",&choice);
switch(choice)
{
case 0:break;
case ??:InputInfo();break;
case ??:Input();break;
case 3:callfare();break;
case 4:calldetail();break;
case 5:modify();break;
case 6:deleteinfo();break;
default:break;
}
}while(choice);
return 0;
}
本文档为【【最新+免费】模拟IP话费管理系统】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。