资源简介
电信计费系统C++,代码类,含有类文件,含有菜单形式
代码片段和文件信息
#include
#include
#include
using namespace std;
const double a=25;
const double b=6;
const double c=0.1;
const double d=0.7;
const int m=30;
const int n=200;
class cust1
{
public:
char name[100];
char numb[9];
char cr;
cust1(char *achar* bchar c)
{
strcpy(namea);
strcpy(numbb);
cr=c;
}
cust1()
{}
~cust1()
{}
};
class cust2
{
public:
char numb1[9];
char numb2[100];
char time1[15];
char time2[15];
cust2(char* achar* bchar* t1char* t2 )
{
strcpy(numb1a);
strcpy(numb2b);
strcpy(time1t1);
strcpy(time2t2);
}
cust2()
{}
~cust2()
{}
};
istream & operator >>(istream & incust1 & cust11)
{
in>>cust11.name;
in>>cust11.numb;
in>>cust11.cr;
return in;
}
istream & operator >>(istream & incust2 & cust22)
{
in>>cust22.numb1;
in>>cust22.numb2;
in>>cust22.time1;
in>>cust22.time2;
return in;
}
void qwer(double &xdouble&ydouble&zcust2 &cust22)
{
int yearmonthdayhourminutesecond;
int year11month11day11hour11minute11second11;
int year22month22day22hour22minute22second22;
year11=(cust22.time1[0]-48)*1000+(cust22.time1[1]-48)*100+(cust22.time1[2]-48)*10+(cust22.time1[3]-48);
month11=(cust22.time1[4]-48)*10+(cust22.time1[5]-48);
day11=(cust22.time1[6]-48)*10+(cust22.time1[7]-48);
hour11=(cust22.time1[8]-48)*10+(cust22.time1[9]-48);
minute11=(cust22.time1[10]-48)*10+(cust22.time1[11]-48);
second11=(cust22.time1[12]-48)*10+(cust22.time1[13]-48);
year22=(cust22.time2[0]-48)*1000+(cust22.time2[1]-48)*100+(cust22.time2[2]-48)*10+(cust22.time2[3]-48);
month22=(cust22.time2[4]-48)*10+(cust22.time2[5]-48);
day22=(cust22.time2[6]-48)*10+(cust22.time2[7]-48);
hour22=(cust22.time2[8]-48)*10+(cust22.time2[9]-48);
minute22=(cust22.time2[10]-48)*10+(cust22.time2[11]-48);
second22=(cust22.time2[12]-48)*10+(cust22.time2[13]-48);
if(second22>=second11)
second=second22-second11;
else
{
second=second22-second11+60;
minute22-=1;
}
if(minute22>=minute11)
minute=minute22-minute11;
else
{
minute=minute22-minute11+60;
hour22-=1;
}
if(hour22>=hour11)
hour=hour22-hour11;
else
{
hour=hour22-hour11+24;
day22-=1;
}
if(day22>=day11)
day=day22-day11;
else
{
if(month22==4||month22==6||month22==9||month22==11)
day=day22-day11+30;
else if(month22==1||month22==3||month22==5||month22==7||month22==8||month22==10||month22==12)
day=day22-day11+31;
else
day=day22-day11+28;
month22-=1;
}
if(month22>=month11)
month=month22-month11;
else
{
month=month22-month11+12;
year22-=1;
}
if(year22>=year11)
year=year22-year11;
else
year=year22;
if(cust22.numb2[0]!=48)
{
if(second>0)
x=double(x+(hour*60+minute+1)*c);
else
x=double(x+(hour*60+minute)*c);
}
else
{
if(second>0)
y=double(y+(hour*60+minute+1)*d);
else
y=double(y+(hou
- 上一篇:单片机 多级菜单
- 下一篇:c语言综合程序--ATM机
评论
共有 条评论