C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

plz correct this program

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
nisha
Guest





PostPosted: Sun Aug 13, 2006 9:10 am    Post subject: plz correct this program Reply with quote



A#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>A
#include<graphics.h>
#include<process.h>
fstream dat,dat1;
float gsal,pf;
char flname[]={"dsb"};
class emptax
{
public:
char
no[10],fname[20],lname[20],desig[20],bg[5],em[80],lnam[30],rnam[25],cnam[30],snam[30];
long int ph,pin,emp;
float
bsal,da,hra,cca,msal,lo,sd,tit,ti,tr,tf,tp,pt,tpt,ttp,nt,ec,lic,nsc,pm,ot,not,others;
void get_nam();
void dsp_nam();
void tax_cal();
void fl_write();
void fl_read();
void fl_delete();
void fl_insert();

}obj,obj1;

void emptax::get_nam()
{ cout<<"\nEmployee Code:";cin>>emp;
cout<<"First name:"; gets(fname);
cout<<"Last name:"; gets(lname);
cout<<"Designation:"; gets(desig);
cout<<"House no.:"; cin>>no;
cout<<"Location:"; gets(lnam);
cout<<"Region:"; gets(rnam);
cout<<"City:"; gets(cnam);
cout<<"State:"; gets(snam);
cout<<"Pincode:"; cin>>pin;
cout<<"Phone (resi):"; cin>>ph;

cout<<"\t\t"<<"\n\nENTER YOUR MONTHLY SALARY DETAILS\n";
cout<<"Basic salary per month:"; cin>>bsal;
cout<<"Enter your CCA:"; cin>>cca;
cout<<"DA:"; cin>>da;
cout<<"Lone Installments:"; cin>>lo;
cout<<" HRA:"; cin>>hra;
// cout<<"CCA:"; cin>>cca;
cout<<"other income:"; cin>>others;


cout<<"\nLIC premium:"; cin>>lic;
cout<<"NSC premium:"; cin>>nsc;
// cout<<"Income tax paid till last month @:"; cin>>pt;
cout<<"\n\nDonation for social cause:\n";
cout<<"Donation for PM funds:"; cin>>pm;
cout<<"Doantion for other trusts:"; cin>>ot;
cout<<"Tution fees:"; cin>>tf;
}
void emptax::dsp_nam()
{
clrscr();
cout<<"******************************!PERSONAL
DETAILS!********************************";
cout<<"\nName:\t\t"<<fname<<" "<<lname<<endl;
cout<<"\nAddress:\t";
cout<<no<<" "<<lnam<<",\n\t\t"<<rnam<<",\n\t\t"<<cnam
<<",\n\t\t"<<snam<<"\n\t\t"<<pin<<"\nPhone(resi):\t"<<ph;

cout<<"\n\n***********************$MONTHLY/YEARLY SALARY
DETAILS$**************************";
cout<<"\n"<<"\t\t\t\tMONTHLY\t\t\tYEARLY";
cout<<"\n\nBasic salaray:\t\t\t"<<bsal<<"\t\t"<<bsal*12;
cout<<"\nCity Compancatory Allowence:\t"<<cca<<"\t"<<cca*12;
cout<<"\nDearness Allowence:\t\t"<<da<<"\t\t"<<da*12;
cout<<"\nHouse Rent Allowence:\t\t"<<hra<<"\t\t"<<hra*12;
cout<<"\nProvidend Fund:\t\t\t"<<pf<<"\t\t"<<pf*12;
cout<<"\nLone Installments:\t\t"<<lo<<"\t\t"<<lo*12;
cout<<"\n$GROSS SALARY$:\t\t\t"<<msal<<"\t\t"<<msal*12;
getch();

cout<<"\n\n******************************!INCOME TAX
DETAILS!******************************";
cout<<"\nGross Salary:\t\t\t"<<msal*12;
cout<<"\nStandard Deduction:\t\t"<<sd;
cout<<"\nTaxable Income:\t\t\t"<<ti;
cout<<"\nTotal Tax Payable:\t\t"<<tit;
cout<<"\nNet Tax Rebte:\t\t\t"<<tr;
cout<<"\Education Cess:\t\t\t"<<ec;
// cout<<"\nTotal Tax Paid:\t\t\t"<<tpt;
cout<<"\nNet Tax Still To Be Paid:\t"<<nt;
}

void emptax::tax_cal()
{
da=(bsal*11)/100;
hra=(bsal*15)/100;

msal=bsal+da+hra+cca+others;
gsal=(msal*12);

pf=(((bsal+da)*12)/100);

sd=nsc+pf+lic+tf ;
not=(ot*50)/100;

/* if(gsal<150000 && sd>30000)
{
sd=30000;
}
else
if(gsal>150000 && gsal<300000 && sd>25000)
{
sd=25000;
}
else
if(gsal>300000 && gsal<500000 && sd>20000)
{
sd=20000;
}
else
if(gsal>500000)
{
sd=0;
}

*/


ti=(gsal-(sd+pm+not));
if(ti<100000)
{
tit=0;
}
else
if(ti>100001 && ti<150000)
{
tit=((ti-50000)*10)/100;
}
else
if(ti>150001 && ti<250000)
{
tit=(((ti-150000)*20)/100);
}
else
if(ti>250001)
{
tit=(((ti-250000)*30)/100);
}
tr=(lic+nsc+(pf*12));
if(tr>100000)
{
tr=100000;
}
else
{
tr=tr;
}

tp=tit-tr;
ec=(2*tp)/100;
ttp=tp+ec;
tpt=pt*11;
nt=ttp-tpt;
if(nt<0)
nt=0;
}

void emptax::fl_write()
{
char ch;
dat.open(flname,ios::binary|ios::app);
do
{
dat1.open(flname,ios::in|ios::binary);
clrscr();
cout<<"\n -/-/-/-/-/-/-/-/-/-/-/-/-/--- Employee's Information
---/-/-/-/-/-/-/-/-/-/-/";
obj1.get_nam();
do
{
if(dat1.fail())
{
break;
}
else
{
dat1.read((char*)&obj,sizeof(emptax));
if(!dat.eof())
{
if(emp==obj1.emp)
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t-----Sorry This Record Already
Exists(DUPLICATION NOT ALLOWED)------ ";
getch();
dat.close();
dat1.close();
return;
}
}
}
}while(!dat1.eof());
dat.write((char*)&obj1,sizeof(emptax));
clrscr();
cout<<"\n\n\n\n\n\n\n\n\t\t ----Do You Want To Add More----";
do
{
ch=tolower(getche());
}while(ch!='y' && ch!='n');
}while(ch=='y');
dat.close();
dat1.close();
}

void emptax::fl_read()
{
dat.open(flname,ios::binary|ios::in);
do
{
if(dat.fail())
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t-----Sorry This File Contain No
Data------ ";
dat.close();
return;
}
else
{
dat.read((char*)&obj,sizeof(emptax));
if(!dat.eof())
{
obj.tax_cal();
obj.dsp_nam();
}
getch();
}
}while(!dat.eof());
cout<<"\n\t\t--------END OF THE DATABASE-----";
getch();
dat.close();
}

void emptax::fl_insert()
{
dat.open(flname,ios::binary|ios::in);
dat1.open("temp.dat",ios::out|ios::binary);
clrscr();
cout<<"\n Enter The Record To Be Inserted ::";
obj1.get_nam();
obj1.tax_cal();
do
{
if(dat.fail())
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t-----Sorry This File Contain No
Data------ ";
dat.close();
dat1.close();
getch();
return;
}
else
{
dat.read((char*)&obj,sizeof(emptax));
if(emp==obj1.emp)
{ clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\t\t-----This Record Already
Exists-------";
cout<<"\n\n\n\n\t\t-----Unsuccessfull Record Insertion------";
dat1.close();
dat.close();
getch();
return;
}
if(emp > obj1.emp)
{
break;
}
if(!dat.eof())
{
dat1.write((char*)&obj,sizeof(emptax));
}
}
}while(!dat.eof());
dat1.write((char*)&obj1,sizeof(emptax));
do
{
if(dat.fail())
{
cout<<" ";
}
else
{
if(!dat.eof())
{
dat1.write((char*)&obj,sizeof(emptax));
}
dat.read((char*)&obj,sizeof(emptax));
}
}while(!dat.eof());
dat.close();
dat1.close();
if((remove(flname)==0)&&(rename("temp.dat",flname)==0))
{ clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t--------Record Inserted
Successfully-------";
getch();
}
}

void emptax::fl_delete()
{
int empn;
dat.open(flname,ios::binary|ios::in);
dat1.open("temp.dat",ios::out|ios::binary);
cout<<"\n Enter The Employee Code No.::";
cin>>empn;
clrscr();
do
{
if(dat.fail())
{ cout<<"Unable To Open";
dat.close();
dat1.close();
return;
}
else
{ dat.read((char*)&obj,sizeof(emptax));
if(emp==empn)
{
break;
}
if(!dat.eof())
{
dat1.write((char*)&obj,sizeof(emptax));
}
}
}while(!dat.eof());
if(emp!=empn)
{ clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\t\t ------THIS RECORD DOESN'T
EXISTS-----";
getche();
dat.close();
dat1.close();
return;
}
do
{
if(dat.fail())
{ cout<<"----Error Occurred Trminating Function-----";
getch();
dat.close();
dat1.close();
return;
}
else
{ dat.read((char*)&obj,sizeof(emptax));
if(!dat.eof())
{
dat1.write((char*)&obj,sizeof(emptax));
}
}
}while(!dat.eof());
dat.close();
dat1.close();
if((remove(flname)==0)&&(rename("temp.dat",flname)==0))
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t--------Record Deleted
Successfully-------";getch();
}
}

void main()
{
textcolor(1);
textbackground(6);
char ch;
do
{
clrscr();
cout<<"Enter ur choice as mentioned";
cout<<"\n Enter Records"
<<"\n View Records"
<<"\n Insert Records"
<<"\n Delete Records"
<<"\n Quit Records\n";
cin>>ch;
switch(ch)
{
case 'e':obj.fl_write();
break;
case 'v':obj.fl_read();
break;
case 'i':obj.fl_insert();
break;
case 'd':obj.fl_delete();
break;
case 'x':exit(0);
break;
default:cout<<"!Wrong choice!";
break;
}
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t -----Do You Want To Continue----";
do
{ ch=tolower(getche());
}while(ch!='y' && ch!='n');
}while(ch=='y');
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t--------T H A N K Y O U -------";
getch();
}
Back to top
Thomas J. Gritzan
Guest





PostPosted: Sun Aug 13, 2006 9:10 am    Post subject: Re: plz correct this program Reply with quote



nisha schrieb:
Quote:
A#include<fstream.h

#include <fstream>

Quote:
#include<conio.h

non-standard

Quote:
#include<stdio.h
#include<ctype.h>A
[sniped long source code]


Remove the "A"

And what is your question, actually?

--
Thomas
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.