资源描述:
《定期储蓄存款利息计算源码》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、/*lxjs.c*/getll(mk,bp,ep,rd,rv)charmk[];longbp,ep,rd[];doublerv[];{inti,l,cc;chars[5];RATEp;i=0;fileopen(FILEOPEN,"drate","nu_rq",ratlist,RAT_N);strcpy(p.num,mk);p.rq=bp;cc=dbfind("drate",GREATER,(char*)0,&l,&p);if(cc)cc=dbfind("drate",LAST,(char*)0,&l,&p);else
2、cc=dbfind("drate",PREVIOUS,(char*)0,&l,&p);if(cc
3、
4、strcmp(mk,p.num)){if(mk[0]-'!')next("计息时遇到错误....利率找不到:",mk,1);fileclose("drate");return(-1);}rd[i]=p.rq;rv[i]=p.rate;cc=dbfind("drate",NEXT,(char*)0,&l,&p);while(cc==0&&strcmp(mk,p.num)==0&&ep>p.rq){i++;rd[i]=p.
5、rq;rv[i]=p.rate;cc=dbfind("drate",NEXT,(char*)0,&l,&p);}fileclose("drate");return(i);}get1ll(zh,qx,ld,x)charzh[];intqx;longld;double*x;{intl;charnu[20];longrd[5];doublerv[5];INDEXp;strcpy(nu,zh);sprintf(nu+4,"%3d",qx);if(nu[4]=='')nu[4]='0';if(nu[5]=='')nu[5]='
6、0';nu[7]=0;fileopen(FILEOPEN,"dindex","idxnu",idxlist,IDX_N);dbfind("dindex",COMPARISON,nu,&l,&p);fileclose("dindex");strcpy(nu,p.idxref);l=getll(nu,ld,ld,rd,rv);/*l=getll(nu,ld+1,ld+1,rd,rv);*/if(l==-1)*x=0.0;else*x=rv[0];return;}hzgblx(lb,le,ce,lx,nu)longlb,l
7、e;doublece,*lx;char*nu;{inti,n;intdd;longrd[30];doublerv[30],xx;n=getll(nu,lb,le,rd,rv);if(n==-1){*lx=0.0;return(-1);}rd[n+1]=le;i=1;xx=0.0;while(i<=n+1){if(i==1)dd=ldayof(lb,rd[i]);elsedd=ldayof(rd[i-1],rd[i]);xx+=ce*dd*rv[i-1]/(360*100);i++;}i=(xx<0.00)?(-10)
8、:10;/**/modf(fabs(xx/10)+0.5,lx);/*变为毫后再舍入*/*lx*=i;return(0);}hzlx(nu,ld,m,lx)char*nu;longld;doublem,*lx;{intk,mm,d,dd;shorty[3];doublex,ll;rjulmdy(ld,y,YDATETYPE);/*get1ll(nu,0,ld,&ll);*/d=(y[2]>30)?30:y[2];mm=(y[1]>=7)?y[1]:(y[1]+12);dd=360-((mm-7)*30+d-1);k=
9、(m<0.00)?(-1):1;modf((m*k)/100,&x);x=x*dd*3/300;modf(x*10+0.5,lx);*lx=*lx*k/10;/*给出三厘积数*/return;}tzlx(nu,kh,ld,m,lx,ll)char*nu;longld,kh;doublem,*lx,*ll;{longdays;inti;doublex,ll1,ll2;days=ldayof(kh,ld);i=(int)(days/30);if(i>=12)i=13;elseif(i>=1)i++;elseif(days
10、>=15)i=1;elsei=0;get1ll(nu,i,ld,&ll2);get1ll(nu,0,ld,&ll1);if(i==13)x=-1*m*(360*ll2+(days-360)*ll1)/(360*100);elsex=-1*m*days*ll2/(360*100);*ll=ll2;modf((x+0.5),lx);return;}