Professional Documents
Culture Documents
SWARANGI
SWARANGI
PROJECT
MADE BY:-
SWARANGI MHATRE
STD-XII SCIENCE
REQUIREMENTS
RAM: - 512MB.
For a time, C++ had no official standard and was maintained by a de- facto
standard, however since 1993, C++ is standardized by a committee of the
ISO.
OUT OF PROGRAM
Enter
Telephone No.
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<process.h>
#include<dos.h>
class tel_bil
{
private:
int calls;
char name[100],adrs[100];
char city[30];
public:
char tel_no[15];
long unsigned int cons_no;
void show_data();
void get_data();
};
fstream file;
void tel_bil::get_data()
{
char ch;
cin.get(ch);
cout<<"\n\tENTER NAME: ";
cin.getline(name,30);
cout<<"\n\tENTER ADDRESS: ";
cin.getline(adrs,100);
cout<<"\n\tENTER CITY: ";
cin.getline(city,40);
cout<<"\n\tENTER TOTAL NO. OF CALLS: ";
cin>>calls;
void tel_bil::show_data()
{
float tax=0.02;
float charge;
int n;
char ch;
if(calls>=50)
{
n=calls-50;
tax=tax*n;
charge=tax+(2*n)+60;
}
else
{
n=0;
tax=0;
charge=60;
}
void main()
{
clrscr();
tel_bil a;
int choice;
char ch;
cout<<"\n\n\n\t\t\tWELCOME TO THE PROJECT";
cout<<"\n\t\t ";
cout<<"\n\n\t\t\tTELEPHONE BILLING SYSTEM";
cout<<"\n\t\t ";
delay(2000);
while(1)
{
clrscr();
cout<<"\n\t\t\t\tOPTIONS";
cout<<"\n\t1. TO ADD NEW RECORD"<<"\n\t2. TO SEE
RECORD"<<"\n\t3. FOR ENQUIRY"
<<"\n\t4. TO MODIFY RECORD"<<"\n\t5. TO DELETE"<<"\n\t6. QUIT";
cout<<"\n\n\tENTER YOUR CHOICE: ";
cin>>choice;
clrscr();
file.open("tel.dat",ios::in|ios::binary|ios::out|ios::app|ios::ate);
do
{
file.read((char*)&a,sizeof(a));
if(strcmp(a.tel_no,no)==0)
{
cout<<"\n\n\t\tTHIS TELEPHONE NO. ALREADY EXIST .......... ";
flag=1;
getch();
break;
}
}while(!file.eof());
file.close();
if(flag==0)
{
file.open("tel.dat",ios::in|ios::binary|ios::out|ios::app|ios::ate);
file.seekp(0,ios::end);
p=file.tellp();
q=(p/sizeof(a))+1;
strcpy(a.tel_no,no);
a.cons_no=q;
a.get_data();
file.write((char*)&a,sizeof(a));
cout<<"\n\n\t\tRECORD ADDED. ............. ";
file.close();
getch();
}
}
file.seekg(0);
int t=0;
while(file.read((char*)&a,sizeof(a)))
{
t=1 ;
cout<<"\n\n";
a.show_data();
getch();
}
if(t==0)
{
cout<<"\n\n\t\tFILE DOES NOT EXIST ............. ";
getch();
}
file.close();
}
do
{
file.read((char*)&a,sizeof(a));
if(strcmp(a.tel_no,no1)==0)
{
a.show_data();
i=1;
getch();
break;
}
}while(!file.eof());
if(i==0)
{
cout<<"\n\n\t\tTHIS TELEPHONE NO. DOES NOT EXIST ......... ";
getch();
}
file.close();
}
file.open("tel.dat",ios::in|ios::binary|ios::out);
char no2[15],no3[15];
file.seekg(0);
cout<<"\n\n\t\tENTER THE TELEPHONE NO. TO BE MODIFIED: ";
cin.get(ch);
cin.getline(no2,15);
if(s==0)
{
cout<<"\n\n\t\tNO. NOT FOUND. ...... " ;
getch();
}
file.close();
}
file.open("tel.dat",ios::in|ios::out);
fstream fp2;
fp2.open("Temp.dat",ios::out);
file.seekg(0,ios::beg);
fp2.seekg(0,ios::beg);
while(file.read((char*)&a,sizeof(a)))
{
if(strcmp(a.tel_no,no)==0)
{
a.show_data();
k=1;
cout<<"\n\n\t\tRECORD DELETED ....... ";
}
else
fp2.write((char*)&a,sizeof(a));
}
fp2.close();
file.close();
if(k==0)
{
cout<<"\n\n\t\tNO. NOT FOUND. ......";
}
remove("tel.dat");
rename("Temp.dat","tel.dat");
getch();
clrscr();
}
else
{
cout<<"\n\n\t\tWRONG CHOICE .... ";
delay(1000);
}
}
}
Output
1. Welcome Screen
2. Menu
3. To Add Record
4. To See Record
IF FILE tel.dat DOES NOT EXIST
5. For Enquiry
IF NO. DOES NOT EXIST
6. To Modify Record
IF NO. DOES NOT EXIST
7. To Delete Record
a. BOOKS
1. Computer science with C++ by Sumita
Arora
B. websites
1. www.google.com
2. wikipedia