Beruflich Dokumente
Kultur Dokumente
h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
class tele
{
char name[40],adr[40],d[15],dt[15];
long int teln,tc;
public:
void add();
void delee();
void modify();
void display();
void detail();
void printbill();
void screen();
void screen1();
}t;
void main()
{
int ch;
do
{
clrscr();
t.screen();
case 7:clrscr();
t.screen();
gotoxy(35,12);cout<<"THANKS YOU & GOODBYE";
gotoxy(35,14);cout<<"++++++++++++++++++++++";
gotoxy(50,24);cout<<"PRESS ANY KEY TO CONTINUE";
getch();
break;
default:clrscr();t.screen();
gotoxy(35,15);cout<<"INVALID CHOICE";
gotoxy(50,24);cout<<"Press any key to continue";
getch();
}
}
while(ch!=7);
}
void tele::add()
{
fstream f;
f.open("Bill.dat",ios::app|ios::binary);
clrscr();
char ans='y';
do
{
screen();
gotoxy(35,5);cout<<"Add Data";
gotoxy(35,6);cout<<"*********";
gotoxy(17,9);cout<<"Name:->";gets(name);
gotoxy(17,10);cout<<"Address:->";gets(adr);
gotoxy(17,11);cout<<"Last due Date:->";gets(d);
gotoxy(17,12);cout<<"Telephone no:->";cin>>teln;
gotoxy(17,13);cout<<"Total calls:->"; cin>>tc;
gotoxy(17,14);cout<<"Bill Date:->";gets(dt);
f.write((char*)&t,sizeof(t));
screen();
gotoxy(25,12);cout<<"Enter any more records(y/n)?:";
cin>>ans;
}while(ans=='y');
return;
}
void tele::delee()
{
clrscr();
int flag;
long int n;
char ans,ans1;
do
{
flag=0;
screen();
fstream f,f1;
f.open("Bill.dat",ios::in|ios::binary);
f1.open("Billu.dat",ios::out|ios::binary);
gotoxy(32,7);cout<<"Deleting of records";
gotoxy(32,8);cout<<"^^^^^^^^^^^^^^^^^^^";
gotoxy(15,9);cout<<"Enter the tel. no whose records is to be deleted:->";
cin>>n;ans1=' ';
while(f)
{
f.read((char*)&t,sizeof(t));
if(n==teln)
{
flag=1;
gotoxy(12,11);cout<<"Telephone no:->"<<teln;
gotoxy(12,12);cout<<"Name:->"<<name;
gotoxy(12,13);cout<<"Address:->"<<adr;
gotoxy(12,14);cout<<"Last due Date:->"<<d;
gotoxy(12,15);cout<<"Total calls:->"<<tc;
gotoxy(12,16);cout<<"Bill Date:->"<<dt;
gotoxy(15,20);cout<<"Are you sure you want to delete this
record(y/n)?:";
ans1=getchar();
}
if((ans1=='n')||(n!=teln))
{
f1.write((char*)&t,sizeof(t));
}
}
screen();
if(flag==0)
{
gotoxy(28,10);cout<<"Your record does not exist";
gotoxy(28,11);cout<<"<<<<<<<<<<<<<<>>>>>>>>>>>>>>>";
gotoxy(50,24);cout<<"Press any key to continue";
getch();
}
else if(flag==1&&ans1=='y')
{
gotoxy(28,12);cout<<"Your record is deleted";
gotoxy(28,13);cout<<"<<<<<<<<<<<<<<>>>>>>>>>>>>>>>";
gotoxy(50,24);cout<<"Press any key to continue";
getch();
}
f.close();
f1.close();
f.open("Bill.dat",ios::out|ios::binary);
f1.open("Billu.dat",ios::in|ios::binary);
while(f1)
{
f1.read((char*)&t,sizeof(t));
f1.write((char*)&t,sizeof(t));
}
f1.close();
f.close();
gotoxy(25,15);cout<<"Do you want to delete more records(y/n):";
ans=getchar();
}
while(ans=='y');
}
void tele::modify()
{
int flag;
long int n;
char ans;
fstream f,f1;
do
{
clrscr();
screen();
gotoxy(32,7);cout<<"Editing of records";
gotoxy(32,8);cout<<"^^^^^^^^^^^^^^^^^^";
f.open("Bill.dat",ios::in|ios::binary);
f1.open("Billu.dat",ios::out|ios::binary);
gotoxy(15,15);cout<<"Enter the tel. no whose records is to be modified:->";
cin>>n;
while(f)
{
flag=0;
f.read((char*)&t,sizeof(t));
if(teln==n)
{
flag=1;
screen();
gotoxy(17,8);cout<<"Enter modified data";
gotoxy(17,9);cout<<"*******************";
gotoxy(17,10);cout<<"Telephone no:->";cin>>teln;
gotoxy(17,11);cout<<"Name:->";gets(name);
gotoxy(17,12);cout<<"Address:->";gets(adr);
gotoxy(17,13);cout<<"Last due Date:->";gets(d);
gotoxy(17,14);cout<<"Total calls:->"; cin>>tc;
gotoxy(17,15);cout<<"Bill Date:->";gets(dt);
}
f1.write((char*)&t,sizeof(t));
}
if(flag==0)
{
screen();
gotoxy(20,12);cout<<"Your record does not exist";
gotoxy(20,13);cout<<"<<<<<<<<<<<<<<>>>>>>>>>>>>>>>";
void tele::detail()
{
clrscr();
screen();
tc";
dt";
void tele::display()
{
char ans;
int flag;
long int n;
fstream f,f1;
do
{
flag=0;
clrscr();
screen();
gotoxy(32,9);cout<<"viewing of records";
gotoxy(32,10);cout<<"^^^^^^^^^^^^^^^^^^^^";
gotoxy(20,12);cout<<"Enter the tel. no ";cin>>n;
gotoxy(50,24);cout<<"Press any key to continue";
getch();
f.open("Bill.dat",ios::in|ios::binary);
screen();
while(f)
{
f.read((char*)&t,sizeof(t));
if(n==teln)
{
flag=1;
gotoxy(35,8);cout<<"Telephone record";
gotoxy(35,9);cout<<"++++++++++++++++";
gotoxy(12,12);cout<<"Telephone no:->"<<teln;
gotoxy(12,13);cout<<"Name:->"<<name;
gotoxy(12,14);cout<<"Address:->"<<adr;
gotoxy(12,15);cout<<"Last due Date:->"<<d;
gotoxy(12,16);cout<<"Total calls:->"<<tc;
gotoxy(12,17);cout<<"Bill Date:->"<<dt;
}
}
f.close();
if(flag==0)
{
gotoxy(20,12);cout<<"Your record does not exist";
gotoxy(20,13);cout<<"<<<<<<<<<<<<<<>>>>>>>>>>>>>>>";
}
gotoxy(50,24);cout<<"Press any key to continue";
getch();
clrscr();
screen();
gotoxy(20,12);cout<<"Do you want to view more records(y/n)?";
ans=getchar();
}
while(ans=='y');
}
void tele::printbill()
{
int nc;
float ba,msc,ta,eba;
clrscr();
fstream f;
f.open("Bill.dat",ios::in|ios::binary);
while(f)
{
f.read((char*)&t,sizeof(t));
ba=0.0;
nc=0;
eba=msc=0.0;
if(tc>150&&tc<=250)
{
nc=tc-150;
ba=0.8*(tc-150);
}
else if(tc>250)
{
nc=tc-150;
ba=2*(tc-250)+80;
}
else
{
nc=0;
}
msc=0.05*(ba+360);
ta=ba+360+msc;
eba=ta+20;
screen1();
gotoxy(25,4);cout<<"DEPARTMENT OF TELECOMMUNICATION";
gotoxy(30,5);cout<<"MEERUT TELECOM DISTRICT";
gotoxy(16,6);cout<<"_._._._._._._._._._._._._._._._._._._._._._._._._";
gotoxy(33,7);cout<<"TELEPHONE BILL";
gotoxy(16,8);cout<<"_._._._._._._._._._._._._._._._._._._._._._._._._";
gotoxy(17,9);cout<<"TO";
gotoxy(20,10);puts(name);
gotoxy(20,11);puts(adr);
gotoxy(25,12);cout<<"------------------------------";
gotoxy(17,13);cout<<"TELEPHONE NO";
gotoxy(32,13);cout<<"BILL DATE";
gotoxy(47,13);cout<<"PAYABLE UPTO";
gotoxy(19,14);cout<<teln;
gotoxy(34,14);cout<<dt;
gotoxy(50,14);cout<<d;
gotoxy(25,15);cout<<"=================================";
gotoxy(17,16);cout<<"GROSS CALLS";
gotoxy(32,16);cout<<"FREE CALLS";
gotoxy(47,16);cout<<"NET CALLS";
gotoxy(20,17);cout<<tc;
gotoxy(35,17);cout<<"150";
gotoxy(50,17);cout<<nc;
gotoxy(25,18);cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
gotoxy(17,19);cout<<"RENTAL AMOUNT:->360";
gotoxy(39,19);cout<<"CALLS CHARGES:->"<<ba;
gotoxy(17,20);cout<<"MISC AMOUNT:->"<<msc;
gotoxy(17,21);cout<<"TOTAL AMOUNT:->"<<ta;
gotoxy(17,22);cout<<"AMOUNT AFTER DUE DATE_;>"<<eba;
gotoxy(50,24);cout<<"PRESS ANY KEY TO CONTINUE";
getch();
}
f.close();
}
void tele::screen()
{
clrscr();
int i,j;
for(i=4;i<=22;i++)
{
gotoxy(10,i);cout<<'*';
gotoxy(75,i);cout<<'*';
}
for(j=10;j<=75;j++)
{
gotoxy(j,4);cout<<'*';
gotoxy(j,22);cout<<'*';
}
}
void tele::screen1()
{
clrscr();
int i,j;
for(i=3;i<=23;i++)
{
gotoxy(15,i);cout<<'*';
gotoxy(65,i);cout<<'*';
}
for(j=15;j<=65;j++)
{
gotoxy(j,3);cout<<'I';
gotoxy(j,23);cout<<'I';
}
}