i wish someone can help me with this error
i have highlighted the errors in block letters
i want urgent help plz .. i must give project tomorrow
Expand|Select|Wrap|Line Numbers
- #include<fstream.h>
- #include<conio.h>
- #include<string.h>
- #include<stdio.h>
- #include<stdlib.h>
- void login();
- struct date
- {
- int dd,mm,yy;
- };
- class employee
- {
- public:
- int empno;
- char firstname[15],lastname[15],address[50],designation[20];
- float basicsalary,deductions,itax,PF,conveyance,HRA,DA,grosspay,netpay;
- date dob,doj;
- void getdata();
- void showdata();
- void search();
- void displayall();
- void salaryslip();
- }emp;
- void main()
- {
- employee emp;
- login();
- int choice;
- do
- {
- main_menu:
- clrscr();
- gotoxy(5,4);
- cout<<" MAIN MENU ";
- gotoxy(5,5);
- cout<<" _____________________ ";
- gotoxy(20,8);
- cout<<"1. ADD RECORD "<<endl;
- gotoxy(20,9);
- cout<<"2. SEARCH EMPLOYEE"<<endl;
- gotoxy(20,10);
- cout<<"3. DISPLAY RECORD"<<endl;
- gotoxy(20,11);
- cout<<"4. CREATE SALARY SLIP"<<endl;
- gotoxy(20,12);
- cout<<"5. DISPLAY ALL RECORDS"<<endl;
- gotoxy(20,13);
- cout<<"6. EXIT"<<endl;
- gotoxy(5,1);
- cout<<"____________________________________________________________";
- gotoxy(5,2);
- gotoxy(5,15);
- cout<<"_____________________________________________________________";
- gotoxy(25,18);
- cout<<"Enter your choice (1-6) : ";
- cin>>choice;
- switch (choice)
- {
- case 1:
- ofstream outfile;
- outfile.open("employee.txt",ios::app|ios::binary);
- emp.getdata();
- emp.grosspay=emp.basicsalary+emp.DA+emp.HRA+emp.conveyance;
- emp.itax=(emp.basicsalary*5)/100;
- emp.deductions=emp.itax+emp.PF;
- emp.netpay=emp.grosspay-emp.deductions;
- outfile.write((char*)&emp, sizeof(emp));
- outfile.close();
- break;
- case 2:
- emp.search();
- break;
- case 3:
- ifstream infile1 ("employee.txt",ios::in|ios::binary);
- if (!infile1)
- {
- clrscr();
- gotoxy(25,12);
- cout<<"Fatal error!!File cannot be opened!";
- exit(1);
- }
- while ((infile1)&&(!infile1.eof()))
- {
- infile1.read((char*)&emp,sizeof(emp));
- if
- ((strlen(emp.firstname)!=0)&&(strlen(emp.designation)!=0))
- emp.showdata();
- }
- infile1.close();
- break;
- case 4:
- emp.salaryslip();
- break;
- case 5:
- emp.displayall();
- break;
- case 6: clrscr();
- gotoxy(20,8);
- cout<<" Thank You ";
- gotoxy(20,10);
- cout<<"This Program has been brought to you by";
- gotoxy(20,12);
- cout<<" **********************************************"<<endl;
- gotoxy(20,14);
- cout<<" * 1. King M.K.A *"<<endl;
- gotoxy(20,16);
- cout<<" * 2. Mandar Pradhan *"<<endl;
- gotoxy(20,18);
- cout<<" * 3. Ali Ismail *"<<endl;
- gotoxy(20,22);
- cout<<" * 4. Manoj Kumar *"<<endl;
- gotoxy(20,22);
- cout<<" ************************************************"<<endl;
- break;
- default: gotoxy(28,33);
- cout<<"Invalid Choice\n";
- gotoxy(26,24);
- cout<<"Press Enter To Retry!";
- getch();
- goto main_menu;
- }
- }while (choice>=1&&choice<=5);
- }
- void employee::getdata()
- {
- clrscr();
- gotoxy(5,2);
- cout<<"_____________________________________________________________________";
- gotoxy(5,4);
- cout<<" Enter Employee Details ";
- gotoxy(5,5);
- cout<<" _______________________________ ";
- gotoxy(5,6);
- cout<<" Employee No : ";
- cout<<" First name : Last Name : ";
- gotoxy(5,9);
- cout<<" Designaition : Basic Salary : ";
- gotoxy(5,10);
- cout<<" Date of Birth : Date of Joining : ";
- gotoxy(5,11);
- cout<<"D.A. : Provident Fund : ";
- gotoxy(5,12);
- cout<<" H.R.A : Conveyance : ";
- gotoxy(5,13);
- cout<<"Address : ";
- gotoxy(5,15);
- cout<<"_____________________________________________________________________";
- gotoxy(20,17);
- cout<<"Press enter for entering each value !";
- gotoxy(22,6);
- cout<<" ";
- gotoxy(22,6);
- cin>>empno;
- gotoxy(22,8);
- cin>>firstname;
- gotoxy(55,8);
- cin>>lastname;
- gotoxy(22,9);
- cin>>designation;
- gotoxy(55,9);
- cin>>basicsalary;
- gotoxy(22,10);
- cout<<" ";
- gotoxy(24,10);
- cout<<"/";
- gotoxy(27,10);
- cout<<"/";
- gotoxy(22,10);
- cin>>dob.dd;
- gotoxy(25,10);
- cin>>dob.mm;
- gotoxy(28,10);
- cin>>dob.yy;
- gotoxy(55,10);
- cout<<" ";
- gotoxy(57,10);
- cout<<"/";
- gotoxy(60,10);
- cout<<"/";
- gotoxy(55,10);
- cin>>doj.dd;
- gotoxy(58,10);
- cin>>doj.mm;
- gotoxy(61,10);
- cin>>doj.yy;
- gotoxy(22,11);
- cin>>DA;
- gotoxy(55,11);
- cout<<" ";
- gotoxy(55,11);
- cin>>PF;
- gotoxy(22,12);
- cin>>HRA;
- gotoxy(55,12);
- cin>>conveyance;
- gotoxy(22,13);
- gets(address);
- gotoxy(20,17);
- cout<<" ";
- gotoxy(43,17);
- cout<<" Press Enter To Continue...";
- getch();
- }
- void employee::showdata()
- {
- clrscr();
- gotoxy(5,2);
- cout<<"________________________________________________";
- gotoxy(5,4);
- cout<<" Enter Employee Details ";
- gotoxy(5,5);
- cout<<" _______________________________ ";
- gotoxy(5,6);
- cout<<" Employee No : ";
- gotoxy(5,8);
- cout<<" First name : Last Name : ";
- gotoxy(5,9);
- cout<<"Designaition : Basic Salary : ";
- gotoxy(5,10);
- cout<<"Date of Birth : Date of Joining : ";
- gotoxy(5,11);
- cout<<"D.A. : Provident Fund : ";
- gotoxy(5,12);
- cout<<" H.R.A : Conveyance : ";
- gotoxy(5,13);
- cout<<"Address: ";
- gotoxy(5,15);
- cout<<"___________________________________________________________________";
- gotoxy(22,6);
- cout<<empno;
- gotoxy(22,10);
- cout<<dob.dd<<"/"<<dob.mm<<"/"<<dob.yy;
- gotoxy(62,10);
- cout<<doj.dd<<"/"<<doj.mm<<"/"<<doj.yy;
- gotoxy(22,8);
- cout<<firstname;
- gotoxy(62,8);
- cout<<lastname;
- gotoxy(22,9);
- cout<<designation;
- gotoxy(62,9);
- cout<<basicsalary;
- gotoxy(22,11);
- cout<<DA;
- gotoxy(62,11);
- cout<<PF;
- gotoxy(22,12);
- cout<<HRA;
- gotoxy(62,12);
- cout<<conveyance;
- gotoxy(22,13);
- cout<<address;
- gotoxy(43,17);
- cout<<" Press Any Key To Continue......................";
- getch();
- }
- void employee::search()
- {
- int employeenumber,flag=0;
- searchmenu:
- clrscr();
- gotoxy(5,1);
- cout<<"_________________________________________________________";
- gotoxy(5,4);
- cout<<" S E A R C H M E N U ";
- gotoxy(5,5);
- cout<<" _______________________ ";
- gotoxy(25,8);
- cout<<" 1. Search by First Name ";
- gotoxy(25,9);
- cout<<" 2. Search by Employee No. ";
- gotoxy(5,18);
- cout<<"__________________________________________________________________";
- gotoxy(26,13);
- cout<<"Enter your choice (1-2) :";
- int x;
- cin>>x;
- switch(x)
- {
- case 1: ifstream infile1;
- infile1.open("employee.txt",ios::in|ios::binary);
- if (!infile1)
- {
- clrscr();
- gotoxy(20,12);
- cout<<"Fatal error!!File cannot be opened";
- exit(1);
- }
- gotoxy(21,13);
- cout<<"Note: Searches are case sensitive! ";
- gotoxy(23,15);
- cout<<"Enter the name of the employee: ";
- char secname[15];
- cin>>secname;
- while ((infile1)&&(!infile1.eof()))
- {
- infile1.read((char*)&emp,sizeof(emp));
- if (infile1.eof())
- break;
- if
- ((strcmp(emp.firstname,secname)==0)&&(strlen(emp.firstname)!=0))
- {
- flag=1;
- emp.showdata();
- }
- }
- if (flag==0)
- {
- gotoxy(27,21);
- cout<<"No such name exists";
- gotoxy(25,23);
- cout<<"Press a key to continue....."<<endl;
- getch();
- }
- infile1.close();
- break;
- case 2:gotoxy(23,13);
- cout<<" ";
- gotoxy(23,13);
- cout<<"Enter the employee number : ";
- cin>>employeenumber;
- ifstream infile2;
- infile2.open("employee.txt",ios::in|ios::binary);
- if (!infile2)
- {
- clrscr();
- gotoxy(20,12);
- cout<<"Fatal error!!File cannot be opened";
- exit(1);
- }
- while ((infile2)&&(!infile2.eof()))
- {
- infile2.read((char*)&emp,sizeof(emp));
- if(infile2.eof())
- break;
- if
- (emp.empno==employeenumber&&(strlen(emp.firstname)!=0))
- {
- clrscr();
- emp.showdata();
- flag=1;
- }
- }
- if (flag==0)
- {
- gotoxy(24,21);
- cout<<"Invalid Employee Number!";
- gotoxy(25,23);
- cout<<"Press a key to continue......"<<endl;
- getch();
- }
- infile2.close();
- break;
- default: cout<<"Wrong choice! Please try again \n";
- cout<<"Press any key to continue.......";
- getch();
- goto searchmenu;
- }
- }
- void employee::salaryslip()
- {
- ifstream infile1;
- infile1.open("employee.txt",ios::in|ios::binary);
- if (!infile1)
- {
- clrscr();
- gotoxy(20,12);
- cout<<"Fatal error! File cannot be opened!";
- exit(1);
- }
- while (infile1&&(!infile1.eof()))
- {
- infile1.read((char*)&emp,sizeof(emp));
- if(infile1.eof())
- break;
- if
- ((strlen(emp.firstname)!=0)&&(strlen(emp.designation)!=0))
- {
- clrscr();
- gotoxy(5,2);
- cout<<"____________________________________________________";
- gotoxy(5,4);
- cout<<" S A L A R Y S L I P ";
- gotoxy(5,5);
- cout<<" ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ";
- gotoxy(5,6);
- cout<<" Emp No. : " <<emp.empno;
- gotoxy(5,7);
- cout<<" Employee Name : "<<emp.firstname;
- gotoxy(5,10);
- cout<<" Earnings ";
- gotoxy(5,11);
- cout<<"ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ";
- gotoxy(5,12);
- cout<<"Basic Salary: "<<emp.basicsalary;
- gotoxy(5,13);
- cout<<"D.A. : "<<emp.DA;
- gotoxy(5,14);
- cout<<"H.R.A. : "<<emp.HRA;
- gotoxy(5,15);
- cout<<"Conveyance : "<<emp.conveyance;
- gotoxy(5,16);
- cout<<"____________________________________________";
- gotoxy(30,10);
- cout<<"Deductions";
- gotoxy(30,11);
- cout<<"_________________ ";
- gotoxy(30,12);
- cout<<"P.F. : "<<emp.PF;
- gotoxy(30,13);
- cout<<" Income Tax : "<<emp.itax;
- gotoxy(43,23);
- cout<<"Press any key to continue....";
- getch();
- }
- }
- infile1.close();
- }
- void employee::displayall()
- {
- clrscr();
- gotoxy(2,2);
- cout<<"____________________________________________________";
- gotoxy(5,3);
- cout<<" Employee";
- gotoxy(18,3);
- cout<<" First Name";
- gotoxy(32,3);
- cout<<" Last Name";
- gotoxy(46,3);
- cout<<"Designation";
- gotoxy(66,3);
- cout<<"Basic";
- gotoxy(8,4);
- cout<<"No.";
- gotoxy(65,4);
- cout<<"Salary";
- gotoxy(2,5);
- cout<<"_____________________________________________________________________";
- int l=6,x=6;
- ifstream infile1;
- infile1.open ("employee.txt",ios::in|ios::binary);
- if (!infile1)
- {
- clrscr();
- gotoxy(35,12);
- cout<<"Fatal error! File cannot be opened";
- exit(1);
- }
- while (infile1&&(!infile1.eof()))
- {
- infile1.read((char*)&emp,sizeof(emp));
- if(infile1.eof())
- break;
- if
- ((strlen(emp.firstname)!=0)&&(strlen(emp.designation)!=0))
- {
- gotoxy(9,1);
- cout<<emp.empno;
- gotoxy(18,1);
- cout<<emp.firstname;
- gotoxy(32,1);
- cout<<emp.lastname;
- gotoxy(46,1);
- cout<<emp.designation;
- gotoxy(66,1);
- cout<<emp.basicsalary;
- ++x;
- ++l;
- if (x==21)
- {
- x=x-21;
- gotoxy(43,1+2);
- cout<<"Press any key to continue..........";
- l=6;
- getch();
- clrscr();
- gotoxy(2,2);
- cout<<"____________________________________________________";
- gotoxy(5,3);
- cout<<" Employee";
- gotoxy(18,3);
- cout<<" First Name";
- gotoxy(32,3);
- cout<<" Last Name";
- gotoxy(46,3);
- cout<<" Designation";
- gotoxy(66,3);
- cout<<" Basic";
- gotoxy(8,4);
- cout<<" No.";
- gotoxy(65,4);
- cout<<"Salary";
- gotoxy(2,5);
- cout<<"_____________________________________________________________________";
- }
- }
- }
- infile1.close();
- getch();
- }
- void login()
- {
- clrscr();
- char *rpass="project";
- int i,b=0,d;
- char temp[20];
- do
- {
- i=0;
- char c;
- gotoxy(21,3);cout<<"-= LOGIN TO THE PROJECT =-";
- gotoxy(25,10);cout<<"Username : Project ";
- gotoxy(25,13);cout<<"Password : ";
- gotoxy(36,10);
- gotoxy(36,13);
- do
- {
- c=getch();
- d=c;
- if(d!=9)
- temp[i]=c;
- cout<<'*';
- if(c!=9)
- i++ ;
- }while(d!=13);
- temp[i-1]='\0';
- if(strcmp(rpass,temp)!=0)
- {
- gotoxy(20,19);
- cout<<"!!!WRONG PASSWORD!!!"<<endl;
- b=b+1;
- if(b==3)
- {
- cout<<"..Sorry!! U have tried 3 times.... now exiting...";
- exit(1);
- }
- }
- else
- {
- gotoxy(20,19);
- cout<<"!!! PASSWORD ACCEPTED !!!"<<endl;
- break;
- }
- }while(b!=3);
- }