资源描述:
《模拟电话计费源代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include#include#includestructcall1{inttel;time_tt1;time_tt2;doublecharge;doubletimedi;};structcall1c1[50];structcall2{inttel;time_tt1;time_tt2;doublecharge;doubletimedi;};structcall2c2[50];structcall3{inttel;time_tt1;time_tt2;doublecharge;doubletimedi;};
2、structcall3c3[50];//先定义这个结构体,这个是系统的函数,就是取时间的。structincome{intk;doubletime;doubletincome;};structincomein[24];structcharge{inttel;charname[30];doubletimeloc;doubletimedom;doubletcharge;};structchargeclient[50];doublecharge1(time_tt1,time_tt2){doublet,charge,n;t=difftime(t2,t1);n=c
3、eil(t/60);if(n<=3)charge=0.22;elsecharge=0.22+0.11*(n-3);return(charge);}doublecharge3(time_tt1,time_tt2){floatn,m;doublet,charge;t=difftime(t1,t2);n=ceil(t/60);m=ceil(t/6);if(n<=3)charge=0.22+0.03*m;elsecharge=0.03*m+0.22+0.11*(n-3);return(charge);}voidmain(void){intr,s,tel,i=0,
4、j=0,k=0;intholiday[7][2];time_ttemp;doubletd;intx,y,h,temp1,l,u=0;intv,mon,d,q,m,n,t,f;inta1,a2,a3,b1,b2,b3;structtm*star;doubletemp2,temp3;holiday[0][0]=1;holiday[0][1]=1;holiday[1][0]=3;holiday[1][1]=8;holiday[2][0]=5;holiday[2][1]=1;holiday[3][0]=5;holiday[3][1]=9;holiday[4][0
5、]=7;holiday[4][1]=1;holiday[5][0]=8;holiday[5][1]=1;holiday[6][0]=10;holiday[6][1]=1;printf("欢迎来到电话计费系统!!!");printf("请阅读以下:");while(q!=6){printf("1:建立客户信息");printf("2:打电话");printf("3:电信公司统计的收入");printf("4:序列的收入");printf("5:打印客户费用:");printf("6:离开!");printf("你的选择:
6、");scanf("%d",&q);if(q==1){for(x=0;x<50;x++){printf("请输入你的电话号码");printf("如果你想离开,请输入0:");scanf("%d",&l);if(l==0)break;client[x].tel=l;printf("请输入客户姓名:");scanf("%s",client[x].name);}v=x;for(x=0;x7、q==2){printf("选择以下选项:");printf("1:本地城市:");printf("2:国内长途:");printf("3:IP:");scanf("%d",&r);if(r==0)break;if(r==1){u=0;printf("输入电话号码:");scanf("%d",&tel);c1[i].tel=tel;printf("开始请输入4:");scanf("%d",&s);if(s==4){c1[i].t1=time(NULL);//令前面定义的t1取系统时间printf("结束请输入5:");sc
8、anf("%d",&s);if(s==5){c1[i].t2=time(NULL