hello
i need to fix the problems in this program. can some one please fix them for me or give me a hint how to fix them cause i really do not know how to fix them.

i also added the errors if you do not have C++ program at the moment. but you can fix them without it :D

#include<iostream>
#include<fstream>
#include<string>
#include <stdlib.h>
#include <conio.h>
#include <ctime>
#include <sys/stat.h>
using namespace std;

const int PASSLEN= 6;
string passget();
struct Employee_Record

{
	int id;								
	string name,age,gender,address;				
	string jobRole,dep,exp,date,salary;
	bool deleted;

};

#define EMPLOYEE_FILE_NAME "Employee.txt"
int Auto = 100;
fstream *fs =NULL, *fs1=NULL;
bool deletion = false;

void closeFile(fstream *);
bool deletion = false;
int main()
{
	ifstream input;
	input.open("id.txt"),ios::in;
	input>>Auto;
	ofstream output;

	string acc,password,MainPage;

	cout<<"\n\n\n\n";
	cout<<"Welcome to INTI LIBRERY"<<endl;
	cout<<"\n\n\n\n";
	cout<<"\t\tPlease Enter ID: \a";
	cin>>acc;
	cout<<"\tPlease Enter Password: ";
	password=passget();
	cout << "\n";
	system("CLS");
	if (acc == "abc" && password == "abc")
	{
		goto MainPage;
	}
	else 
	{
		cout<<"\t\t\t* Please Enter a Valid Account!*\a"<<endl;
		cout<<"\n";
		cout<<"Please Enter ID: ";
		cin>>acc;
		cout<<"Please Enter Password: ";
		password=passget();
		cout<<"\n";
		if (acc=="abc" && password=="abc")
		{
			goto MainPage;
		}
		else
			cout<<"\n\n\t\tWrong ID and Password! Please contact Admin! \n\a\a";
			cout<<"\n\n\n\n\t\t\t****System Terminated!!****\n\n\n";
			goto exit;

			system ("CLS");
	}
}
exit:
return 0;
MainPage:
system("CLS");

	
	{

		enum num { Add = 1, Edit = 2, Delete = 3, Update = 4, Display = 5, Exit = 6};
	}
	do
	{
		int num;
		system( "CLS" );
		cout<<"1.Add New"<<endl;
		cout<<"2.Edit "<<endl;
		cout<<"3.Delete"<<endl;
		cout<<"4.search"<<endl;
		cout<<"5.Display"<<endl;
		cout<<"6.Exit"<<endl;
		cout<<"\n\n\n\n"<<flush;

		cout<<"please select one: ";
		num= _getch();

	}
	while ( num < '1' || num > '6' );
	system ( "CLS" );
	if (num == '2' || num == '3' || num == '4' || num == '5')
	{ 
		if (!isFileExist (EMPLOYEE_FILE_NAME))
		{
			cout<<"Can't open or create '"<<EMPLOYEE_FILE_NAME<<"'file"<<endl;
			system("pause");
			goto MainPage;
		}
	}
	switch(num)
	{
		int confirm;
		int recs_num;
		int id;

	case '1':
		cout<<"Add new records"<<endl;

		cout<<"\nID<AutoGenerate>: ";
			Employee.ID = Auto++;
			cout<<Employee.ID<<endl;

			if (output.open("id.txt"),ios::out)
			{
				output<<Auto;
			}
			else cout<<"The file is empty.";
			output.close();
			cout<<"\nNAME: ";
			cin.get();
			getline(cin,Employee.name);
			while (Employee.name.fin_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops)
			{
				cout<<"\n* Invalid input! Please enter again!*\nNAME: ";
				getline(cin,Employee.name);
			}
			cout<<"AGE";
			cin>>Employee.age;
			while ((Employee.age.size ()>2) || (Employee.age.find_first_of("1234567890")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nAGE";
				cin>>Employee.age;
	cout<<"\nSave record?\n<1=yes, 0=no>";
	cin>>confirm;

	if (confirm == 1)
	{
		fs = new fstream (EMPLOYEE_FILE_NAME, ios::out | ios::app | ios::binary);
		if (!fs)
		{
			cout<<"\n Can't open or create'"<<EMPLOYEE_FILE_NAME<<"'file"<<endl;
			system("pause");
			break;
		}
		fs->write ( (char *) & Employee, sizeof (Employee));
		closefile(fs);
		cout<<"\n Record Added."<<endl;
		system("pause");
		goto Mainpage;

		break;
	case '2':
		cout<<"Edit"<<endl;
		cout<<"please enter employe ID: ";
		cin >>id;
		fs= new fstream ( EMPLOYEE_FILE_NAME, ios::is | ios::out | ios::binary);
		if (!fs)
		{
			cout<<"\nCan't open or create '"<<EMPLOYEE_FILE_NAME<<"'File"<<endl;
			system("pause");
			break;
		}
		recs_num= -1;
		while (fs->read((char*) & Employee,sizeof(Employee)))
		{
			recs_num++;
			if ( Employee.id==id && !Employee.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\n emp don exist"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}

			cout<<"\nNAME: ";
			cin.get();
			getline(cin,Employee.name);
			while (Employee.name.fin_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops)
			{
				cout<<"\n* Invalid input! Please enter again!*\nNAME: ";
				getline(cin,Employee.name);
			}
			cout<<"AGE";
			cin>>Employee.age;
			while ((Employee.age.size ()>2) || (Employee.age.find_first_of("1234567890")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nAGE";
				cin>>Employee.age;
			}
			fs->seekp ( sizeof(Employee) * recs_num, ios::beg);
			fs->write ( (char*) &Employee,sizeof(Employee));
			closeFile(fs);
			cout<<"\nRecord is modified."<<endl;
			system("pause");
			goto MainPage;
			break;
	case 3:
		cout << "delete"<<enld;
		cout<<"please enter employe ID: ";
		cin >>id;
		fs= new fstream ( EMPLOYEE_FILE_NAME, ios::is | ios::out | ios::binary);
		if (!fs)
		{
			cout<<"\nCan't open or create '"<<EMPLOYEE_FILE_NAME<<"'File"<<endl;
			system("pause");
			break;
		}
		recs_num= -1;
				while (fs->read((char*) & Employee,sizeof(Employee)))
		{
			recs_num++;
			if ( Employee.id==id && !Employee.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\n emp don exist"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}
		Employee.deleted = 1;
		fs->seekp ( sizeof(Employee) * recs_num, ios::beg);
		fs->write ( (char*) &Employee, sizeof(Employee));
		closeFile(fs);
		deletion = true;
		cout<<"\nRecord is deleted."<<endl;
		system("pause");
		got MainPage;
		break;
	case '4':
		cout << "search"<<endl;
	cout<<"please enter employe ID: ";
		cin >>id;
		fs= new fstream ( EMPLOYEE_FILE_NAME, ios::is | ios::out | ios::binary);
		if (!fs)
		{
			cout<<"\nCan't open or create '"<<EMPLOYEE_FILE_NAME<<"'File"<<endl;
			system("pause");
			break;
		}
		recs_num= -1;
				while (fs->read((char*) & Employee,sizeof(Employee)))
		{
			recs_num++;
			if ( Employee.id==id && !Employee.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\n emp don exist"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}
		cout<<"\nNAME:\t\t"<<Employee.name<<"\n";
		cout<<"\nAGE:\t\t"<<Employee.age<<"\n";
		system("pause");
		goto MainPage;
		break;
	case 5:
		cout<<"display"<<endl;
		fs = new fstream ( EMPLOYEE_FILE_NAME, ios::in | ios::binary );
		if (!fs)
		{
			cout<<"caanot open'"<<EMPLOYEE_FILE_NAME<<"'file."<<endl;
			system("pause");
			break;
		}
		while (fs->read ( (char *) &Employee, sizeof(Employee) ))
		{
			if ( !Employee.deleted )
			{
				cout<<"\nID:\t\t"<<Employee.ID<<"\n";
				cout<<"\nNAME:\t\t"<<Employee.name<<"\n";
				cout<<"AGE:\t\t"<<Employee.age<<"\n";
			}
		}
		closeFile(fs);
		system ("pause");
		goto MainPage;

	case 6:
		if (deletion)
		{
			cout<<"updating'"<<EMPLOYEE_FILE_NAME<<"'file..."<<endl;
			fs = new fstream( EMPLOYEE_FILE_NAME, ios::in | ios::binary );
			if (!fs)
			{
				cout << "can't open '"<<EMPLOYEE_FILE_NAME<<"'file,then updating is incomplete."<<endl;
				system("pause");
				system("cls");
				return 1;
			}
			fs1 = new fstream ( "temp", ios::out | ios::binary);
			if (!fs)
			{
				cout<< "can't creat ."<<endl;
					system("pause");
				system("cls");
				return 1;
			}
			while (fs->read ( (char *) &Employee, sizeof(Employee)))
				if ( !Employee.deleted )
					fs1->write( (char *) &Employee, sizeof(Employee) );
			closeFile(fs);
			closeFile(fs1);
			if( remove( EMPLOYEE_FILE_NAME ) == -1)
			{
				cout<<"\n Can't delete'"<< EMPLOYEE_FILE_NAME <<"'file, then updating is incomplete."<<endl;
				system("pause");
				system( "cls" );
				cout << "\n\n\n\n\n";
				cout <<"\t\t bye "<< endl;
				return 1;
			}
			struct stat st;
			int res = stat ( "temp", &st);
			if (st.st_size == 0)
				remove ( "temp");
			else
				if (rename( "temp",EMPLOYEE_FILE_NAME) )
				{
					cout << "Canot rename temp file"<<endl;
					system("pause");
						
				cout << "\n\n\n\n\n";
				cout <<"\t\t bye "<< endl;
				return 1;
				}
				cout<< "\n Updateint comp."<<endl;
				system("pause");
		}
		system ("cls");
		cout << "\n\n\n\n\n";
		cout <<"\t\t bye "<< endl;
		break;
		}
		return 0;
		}









	string passget()
	{
		char password[PASSLEN],letter;
		int loop;
		int len;
		string password2;
		
		loop=0;
		while(loop != PASSLEN)
		{
			password[loop]= '\0';
			loop++;
		}
		loop = 0;
		len = 0;
		letter = '\0';
		while ( letter != '\r')
		{
			letter =_gtech();
			if (letter == '\b' && password[0]=='\0')
			{
				loop = 0;
				len =0;
			}
			else 
			{
				if (letter =='\b' && password[0] != '\0')
				{
					cout<<"\b";
					cout<<" ";
					cout<<"\b";
					loop--;
				}
				else 
				{
					if (isprint (letter) != 0 && loop<PASSLEN)
					{
						password[loop]= tolower(letter);
						cout<<"*";
					}
					loop++;
					if (loop<=PASSLEN)
						len++;
				}
			}
		}
		loop = 0;
				len = len;
				password2 = "";
				while (loop !=len)
				{
					password2=password2+password[loop];
					loop++;
				}
				return password2;
	}
	void closeFile (fstream *fs)
	{
		fs->close();
		delete fs;
		fs=NULL;
	}
	bool isFileExist(const char * file_name)
	{
		struct stat st;
		int res= stat (file_name, &st);
		return (res == 0);
	}
Error	21	fatal error C1004: unexpected end-of-file found	 Line	431
Error	12	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	 Line	99
Error	5	error C2630: ';' found in what should be a comma-separated list	 Line	75
Error	7	error C2630: ';' found in what should be a comma-separated list	 Line	78
Error	2	error C2470: 'exit' : looks like a function definition, but there is no parameter list; skipping apparent body	 Line	72
Error	10	error C2447: '{' : missing function header (old-style formal list?)	 Line	83
Error	17	error C2447: '{' : missing function header (old-style formal list?)	 Line	101
Error	20	error C2447: '{' : missing function header (old-style formal list?)	 Line	110
Error	14	error C2440: 'initializing' : cannot convert from 'const char [4]' to 'int'	 Line	99
Error	1	error C2374: 'deletion' : redefinition; multiple initialization	 Line	28
Error	13	error C2365: 'system' : redefinition; previous definition was 'function'	 Line	99
Error	9	error C2143: syntax error : missing ';' before '{'	 Line	83
Error	19	error C2143: syntax error : missing ';' before '{'	 Line	110
Error	11	error C2059: syntax error : 'while'	 Line	98
Error	18	error C2059: syntax error : 'switch'	 Line	109
Error	3	error C2059: syntax error : 'return'	 Line	73
Error	15	error C2059: syntax error : 'if'	 Line	100
Error	8	error C2059: syntax error : 'do'	 Line	82
Error	6	error C2059: syntax error : '{'	 Line	78
Error	4	error C2059: syntax error : ':'	 Line	74

For Error 9 and 19 . i do not know why i need ( ; ) after do and switch (num).

The first error listed is the most important. The problem is more than likely caused by mis-matched brackets, probably missing a closing } somewhere. Start counting open/closing brackets to find out which one is missing.

You are also missing brackets around the multi-line else statement on line 64.

well its kind of odd coz when i try to close all the {} the number of error increase to 130. :S please can any one help me with this . i really need to get this done.

line 28: duplicate variable declaration

lines 73-to end of program -- all the code is outside a function. Function main() ends on line 71 and you never started another function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.