Hello
am trying to do this program as my project.and i was able to fix lots of errors but this few errors i do not know what to do. as my 1st and last semester for programing, am not really good in this subject. i added the errors list hope that would help you. i am really new to C++ so please give any answer in detail.
thank you in advance

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

struct Book_Record
{
	int id,copies,total;							
	string date,published,isbn;					
	string name,author,category,publisher;
	bool deleted;
	};

#define BOOK_FILE_NAME "Books.txt"
Book_Record book;
fstream *fs = NULL, *fs1 = NULL;// file streams for files : fs -> 'add', fs1 -> 'temp'

void closeFile(fstream *); // closes a file with its pointer, then deletes the file pointer
bool isFileExist(const char *); // check if a file exists
bool deletion = false; // if any record has been deleted
void closeFile(fstream *fs)
{
      fs->close(); // close the file
      delete fs;
      fs = NULL;
}
int main()	


{
		enum num { Add = 1, Search = 2, Update = 3, Delete = 4, Display = 5, Total = 6, Exit = 7};
}

		do

	{

	int num;

	system( "CLS" );
	cout << "\n\n\n\t---------Welcome to Librery Book Register System!--------- " <<endl;
	cout << "\t|\t 1. Add Record " <<endl;
	cout << "\t|\t 2. Search Record " <<endl;
	cout << "\t|\t 3. Update Record " <<endl;
	cout << "\t|\t 4. Delete Record " <<endl;
	cout << "\t|\t 5. Display Records " <<endl;
	cout << "\t|\t 6. Total number of Books" <<endl;
	cout << "\t|\t 7. Exit Program " <<endl; 
	cout<<"please select one: ";
	num= _getch();
	}

	while ( num < '1' || num > '7' )

	system ( "CLS" );

	if (num == '2' || num == '3' || num == '4' || num == '5' || num == '6' )

	{ 
		if (!isFileExist (BOOK_FILE_NAME))

		{
			cout<<"Can't open or create '"<<BOOK_FILE_NAME<<"'file"<<endl;
			system("pause");
			goto MainPage;
		}
	}

switch(num)

	{
		int confirm;
		int recs_num;
		int id;
	case '1':		
		{
			do

			{
		cout<<"Add new records"<<endl;

		cout<<"\nBook's ID<AutoGenerate>: ";
			Book.ID = Auto++;
			cout<<"Book.ID"<<endl;

			if (output.open("id.txt"),ios::out)
			{
				output<<Auto;
			}
			else cout<<"The file is empty.";
			output.close();
			cout<<"\n Enter Book's NAME: ";
			cin.get();
			getline(cin,Book.name);
			while (Book.name.size ()>2 || (Book.name.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops)
			{
				cout<<"\n* Invalid input! Please enter again!*\nNAME: ";
				getline(cin,Book.name);
			}
			cout<<"\nBook Author:";
			cin>>Book.author;
			while ((Book.author.size ()>2) || (Book.author.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nAuthor";
				getline(cin,Book.author);
			}
			cout<<"\nBook's Publisher: ";
			getline (cin,Book.publisher);
			while ((Book.publisher.size ()>2) || (Book.publisher.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nPublisher";
				getline(cin,Book.publisher);
			}
			cout<<"\nBook's Category: ";
			getline (cin,Book.category);
			while ((Book.category.size ()>2) || (Book.category.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nPublisher";
				getline(cin,Book.category);
			}
			cout<<"\nYear Book was Published: ";
			cin >> Book.published;
			while ((Book.published.size() >2) || (Book.published.find_first_of( "0123456789" ) == string::npos))
            {
                cout << "Invalid input! Please try again! *\nPublished: ";
                getline (cin, Book.published);
            }
			cout<<"\nBook's ISBN: ";
			getline (cin,Book.isbn);
			while ((Book.isbn.size ()>2) || (Book.isbn.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nISBN";
				getline(cin,Book.isbn);
			}
			cout<<"\nHow Many Copies of Book: ";
			getline (cin,Book.copies);
			while ((Book.isbn.copies ()>2) || (Book.isbn.find_first_of("1234567890")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nISBN";
				getline(cin,Book.isbn);
			}
		char date [10];
		_strdate(date);
		Book.date = date;
				}
	cout<<"\nSave record?\n<1=yes, 0=no>"<<endl;
	cin>>confirm;

	if (confirm == 1)
	{
		fs = new fstream (BOOK_FILE_NAME, ios::out | ios::app | ios::binary);
		if (!fs)
		{
			cout<<"\n Can't open or create'"<<BOOK_FILE_NAME<<"'file"<<endl;
			system("pause");
			break;
		}
		fs->write ( (char *) & Book, sizeof (Book));
		closefile(fs);
	}
		cout<<"\nRecord Added."<<endl;
		system("pause");
		goto Mainpage;
	
	
	break;
	}
	
	case '2':
		{
		cout << "search"<<endl;
		cout<<"please enter Book's ID: ";
		cin >>id;
		fs= new fstream ( BOOK_FILE_NAME, ios::is | ios::out | ios::binary);
		if (!fs)
		{
			cout<<"\nCan't open or create '"<<BOOK_FILE_NAME<<"'File"<<endl;
			system("pause");
			break;
		}
		recs_num= -1;
				while (fs->read((char*) & Book,sizeof(Book)))
		{
			recs_num++;
			if ( Book.id==id && !Book.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\nBook Does not Exist in the Librery"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}
					  cout << "\n\n";
					  cout << "Book's ID\t\t: " << Book.ID << '\n';
					  cout << "Book's Name\t\t: " << Book.name << '\n';
					  cout << "Book's Author\t\t: " << Book.author << '\n';
					  cout << "Book's Publisher\t: " << Book.publisher << '\n';
					  cout << "Book's Category\t\t: " << Book.category << '\n';
					  cout << "Year Publisher\t\t: " << Book.publisher << '\n';
					  cout << "Book's ISBN\t: " << Book.isbn << '\n';
					  cout << "Number of Copies\t: " << Book.copies << '\n';
					  cout << "Added Date\t: " << Book.date << '\n';

				  
                              
        system("pause");
		goto MainPage;
		break;
                 
}
	case '3':
		{
			cout<<"Edit"<<endl;
			cout<<"please enter BOOK's ID: ";
			cin >>id;
			fs= new fstream ( BOOK_FILE_NAME, ios::is | ios::out | ios::binary);
			if (!fs)
				{
					cout<<"\nCan't open or create '"<<BOOK_FILE_NAME<<"'File"<<endl;
					system("pause");
					break;
		}
		recs_num= -1;
		while (fs->read((char*) & Book,sizeof(Book)))
		{
			recs_num++;
			if ( Book.id==id && !Book.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\nBook Does Not Exist in The Librery"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}
		cout<<"\n Enter Book's NAME: ";
			cin.get();
			getline(cin,Book.name);
			while (Book.name.size ()>2 || (Book.name.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops)
			{
				cout<<"\n* Invalid input! Please enter again!*\nNAME: ";
				getline(cin,Book.name);
			}
			cout<<"\nBook Author:";
			cin>>Book.author;
			while ((Book.author.size ()>2) || (Book.author.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nAuthor";
				getline(cin,Book.author);
			}
			cout<<"\nBook's Publisher: ";
			getline (cin,Book.publisher);
			while ((Book.publisher.size ()>2) || (Book.publisher.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nPublisher";
				getline(cin,Book.publisher);
			}
			cout<<"\nBook's Category: ";
			getline (cin,Book.category);
			while ((Book.category.size ()>2) || (Book.category.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nPublisher";
				getline(cin,Book.category);
			}
			cout<<"\nYear Book was Published: ";
			cin >> Book.published;
			while ((Book.published.size() >2) || (Book.published.find_first_of( "0123456789" ) == string::npos))
            {
                cout << "Invalid input! Please try again! *\nPublished: ";
                getline (cin, Book.published);
            }
			cout<<"\nBook's ISBN: ";
			getline (cin,Book.isbn);
			while ((Book.isbn.size ()>2) || (Book.isbn.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nISBN";
				getline(cin,Book.isbn);
			}
			cout<<"\nHow Many Copies of Book: ";
			getline (cin,Book.copies);
			while ((Book.isbn.copies ()>2) || (Book.isbn.find_first_of("1234567890")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nISBN";
				getline(cin,Book.isbn);
			}
		char date [10];
		_strdate(date);
		Book.date = date;


		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 '4':
			
	{
		cout << "delete"<<enld;
		cout<<"please enter Book ID: ";
		cin >>book.id;
		fs= new fstream ( BOOK_FILE_NAME, ios::is | ios::out | ios::binary);
		if (!fs)
		{
			cout<<"\nCan't open or create '"<<BOOK_FILE_NAME<<"'File"<<endl;
			system("pause");
			break;
		}
		recs_num= -1;
				while (fs->read((char*) & Book,sizeof(Book)))
		{
			recs_num++;
			if ( Book.id==id && !Book.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\n Book does not exist in this Librery"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}
		book.deleted = 1;
		fs->seekp ( sizeof(Book) * recs_num, ios::beg);
		fs->write ( (char*) &Book, sizeof(Book));
		closeFile(fs);
		deletion = true;
		cout<<"\nRecord is deleted."<<endl;
		system("pause");
		got MainPage;
		break;
}
case 5:
	{
		cout<<"Display Existing Records"<<endl;
		fs = new fstream ( BOOK_FILE_NAME, ios::in | ios::binary );
		if (!fs)
		{
			cout<<"caanot open'"<<BOOK_FILE_NAME<<"'file."<<endl;
			system("pause");
			break;
		}
		while (fs->read ( (char *) &Book, sizeof(Book) ))
		{
			if ( !Book.deleted )
			{
					cout << "\n\n";
					cout << "Book's ID\t\t: " << Book.ID << '\n';
					cout << "Book's Name\t\t: " << Book.name << '\n';
					cout << "Book's Author\t\t: " << Book.author << '\n';
					cout << "Book's Publisher\t: " << Book.publisher << '\n';
					cout << "Book's Category\t\t: " << Book.category << '\n';
					cout << "Year Publisher\t\t: " << Book.publisher << '\n';
					cout << "Book's ISBN\t: " << Book.isbn << '\n';
					cout << "Number of Copies\t: " << Book.copies << '\n';
					cout << "Added Date\t: " << Book.date << '\n';
			}
		}
		closeFile(fs);
		system ("pause");
		goto MainPage;
		break;

case '7':
	{
		if (deletion)
		{
			cout << "Updating" << BOOK_FILE_NAME << " File..." <<endl;
			fs = new fstream( BOOK_FILE_NAME, ios::in | ios::binary );
			if (!fs)
			{
				cout << " Can not Open "<< BOOK_FILE_NAME << "File, then Updating is incomplete."<<endl;
				system("pause");
				system( "cls" );
				return 1;
			}
			fs1 = new fstream( "temp", ios::out | ios::binary );
			if (!fs1)
			{
				cout<< "Unable to create temp file. Updating was incomplete ."<<endl;
				system("pause");
				system("cls");
				return 1;
			}
			while (fs->read ( (char *) &Book, sizeof(Book)))
				if ( !Employee.deleted )
					fs1->write( (char *) &Book, sizeof(Book) );
			closeFile(fs);
			closeFile(fs1);
			if( remove( BOOK_FILE_NAME ) == -1)
			{
				cout<<"\n Can not delete"<< BOOK_FILE_NAME <<"file, updating is incomplete."<<endl;
				system("pause");
				system( "cls" );
				cout << "\n\n\n\n\n";
				cout << "\t\t*************************************" <<endl;
				cout << "\t\t**                                 **" <<endl;
				cout << "\t\t**            Thank You            **" <<endl;
				cout << "\t\t**            for using            **" <<endl;
				cout << "\t\t**       The Librery System        **" <<endl;
				cout <<"\t\t**                                  **" <<endl;
				cout <<"\t\t**************************************" <<endl;
				cout <<"\n\n\n\n";
				return 1;
			}
			struct stat st;
			int res = stat ( "temp", &st);
			if (st.st_size == 0)
				remove ( "temp");
			else
				if (rename( "temp",BOOK_FILE_NAME) )
				{
				cout << "Canot rename temp file and update was incomplete"<<endl;
				system("pause");
						
				cout << "\n\n\n\n\n";
				cout << "\t\t*************************************" <<endl;
				cout << "\t\t**                                 **" <<endl;
				cout << "\t\t**            Thank You            **" <<endl;
				cout << "\t\t**            for using            **" <<endl;
				cout << "\t\t**       The Librery System        **" <<endl;
				cout <<"\t\t**                                  **" <<endl;
				cout <<"\t\t**************************************" <<endl;
				cout <<"\n\n\n\n";
				return 1;
				}
				cout<< "\nDatabase Update compleded."<<endl;
				system("pause");
		}
				system( "cls" );
				cout << "\n\n\n\n\n";
				cout << "\t\t*************************************" <<endl;
				cout << "\t\t**                                 **" <<endl;
				cout << "\t\t**            Thank You            **" <<endl;
				cout << "\t\t**            for using            **" <<endl;
				cout << "\t\t**       The Librery System        **" <<endl;
				cout <<"\t\t**                                  **" <<endl;
				cout <<"\t\t**************************************" <<endl;
				cout <<"\n\n\n\n";
				break;
	}
	return 0;
	}
}
	
		{
			fs->close();
			delete fs;
			fs = NULL;
		}
		bool isFileExist( const char * file_name)
		{
			struct stat st;
			int res = stat ( file_name, &st );
			return ( res == 0);
		}

the errors

Error	3	error C2447: '{' : missing function header (old-style formal list?)	Line	41
Error	7	error C2447: '{' : missing function header (old-style formal list?)	Line	64
Error	10	error C2447: '{' : missing function header (old-style formal list?)	Line	76
Error	11	error C2447: '{' : missing function header (old-style formal list?)	Line	458
Error	2	error C2143: syntax error : missing ';' before '{'			Line	41
Error	6	error C2143: syntax error : missing ';' before '{'			Line	64
Error	9	error C2143: syntax error : missing ';' before '{'			Line	76
Error	4	error C2059: syntax error : 'while'					Line	58
Error	8	error C2059: syntax error : 'switch'					Line	74
Error	5	error C2059: syntax error : 'if'					Line	62
Error	1	error C2059: syntax error : 'do'					Line	39

I also have a login source code but i cannot input it . i mean when i put that it goes mad.its also added with the post.
and if any one can help me about calculating the records including the number of copies of the books its would be a great help.
again Thank you in advance.

//the code here is bit different then the new one
#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");
	}
}
/////at the end of the code
exit:
return 0;
MainPage:
system("CLS");

////function definition/////
}
		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);
	return 0;
	}

If you reorganized, restructure and format you code so it easy to read and understand, it will simplify finding both logic and syntax problems. As your programs get larger, good code organization will save you lots of time and effort.

If I read correctly, line 31 is the end of main, so the rest of the code is just floating.

Comment your code from line 38 to end using /* and */ and recompile and fix and issues

Then incrementally move the comments and fix the problems.

If you reorganized, restructure and format you code so it easy to read and understand, it will simplify finding both logic and syntax problems. As your programs get larger, good code organization will save you lots of time and effort.

If I read correctly, line 31 is the end of main, so the rest of the code is just floating.

Comment your code from line 38 to end using /* and */ and recompile and fix and issues

Then incrementally move the comments and fix the problems.

i did not get what u saying. 1st are u saying me to write about which function doing what ?
2nd. i did not get ur line 31 comment . that should only for close the file if value not available.

and my primary problem is the syntax errors. because i never saw do, while , switch getting this error.

hahahahaha
i don't know what to do now. i added the code together ( login and main program )and getting new type of problems.
here is the new code.

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

struct Book_Record
{
	int ID,copies,total;							
	string date,published,isbn;					
	string name,author,category,publisher;
	bool deleted;
	};

#define BOOK_FILE_NAME "Books.txt"
Book_Record Book;
int Auto = 100;
fstream *fs = NULL, *fs1 = NULL;// file streams for files : fs -> 'add', fs1 -> 'temp'
bool deletion = false;

void closeFile(fstream *); // closes a file with its pointer, then deletes the file pointer
bool isFileExist(const char *); // check if a file exists
 

int main()	
{
	ifstream input;
	input.open("id.txt"),ios::in;
	input >> Auto;
	ofstream output;

	string acc,password,MainPage;

	cout << "welcome" << endl;
	cout << "\tPlease enter ID: \a";
	cin >> acc;
	cout << "\t\tplease inter password:";
	password = passget();

	system("CLS");

	if (acc == "abc" && password == "abc")
	{
		goto MainPage;
	}
	else
	{
		cout << "\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\n Wrong ID & PASS SYSTEM TERMINED";
	goto exit;

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

	int num;
{
		enum num { Add = 1, Search = 2, Update = 3, Delete = 4, Display = 5, Total = 6, Exit = 7};
}

		do

	{

	int num;

	system( "CLS" );
	cout << "\n\n\n\t---------Welcome to Librery Book Register System!--------- " <<endl;
	cout << "\t|\t 1. Add Record " <<endl;
	cout << "\t|\t 2. Search Record " <<endl;
	cout << "\t|\t 3. Update Record " <<endl;
	cout << "\t|\t 4. Delete Record " <<endl;
	cout << "\t|\t 5. Display Records " <<endl;
	cout << "\t|\t 6. Total number of Books" <<endl;
	cout << "\t|\t 7. Exit Program " <<endl; 
	cout<<"please select one: ";
	num= _getch();
	}

	while ( num < '1' || num > '7' );

	system ( "CLS" );

	if (num == '2' || num == '3' || num == '4' || num == '5' || num == '6' )

	{ 
		if (!isFileExist (BOOK_FILE_NAME))

		{
			cout<<"Can't open or create '"<<BOOK_FILE_NAME<<"'file"<<endl;
			system("pause");
			goto MainPage;
		}
	}

switch(num)

	{
		int confirm;
		int recs_num;
		int id;
	case '1':		
		{
			do

			{
		cout<<"Add new records"<<endl;

		cout<<"\nBook's ID<AutoGenerate>: ";
			Book.ID = Auto++;
			cout<<"Book.ID"<<endl;

			if (output.open("id.txt"),ios::out)
			{
				output<<Auto;
			}
			else cout<<"The file is empty.";
			output.close();
			cout<<"\n Enter Book's NAME: ";
			cin.get();
			getline(cin,Book.name);

			while (Book.name.size ()>2 || (Book.name.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n* Invalid input! Please enter again!*\nNAME: ";
				getline(cin,Book.name);
			}
			cout<<"\nBook Author:";
			cin>>Book.author;

			while ((Book.author.size ()>2) || (Book.author.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nAuthor";
				getline(cin,Book.author);
			}
			cout<<"\nBook's Publisher: ";
			getline (cin,Book.publisher);
			while ((Book.publisher.size ()>2) || (Book.publisher.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nPublisher";
				getline(cin,Book.publisher);
			}
			cout<<"\nBook's Category: ";
			getline (cin,Book.category);
			while ((Book.category.size ()>2) || (Book.category.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nPublisher";
				getline(cin,Book.category);
			}
			cout<<"\nYear Book was Published: ";
			cin >> Book.published;
			while ((Book.published.size() >2) || (Book.published.find_first_of( "0123456789" ) == string::npos))
            {
                cout << "Invalid input! Please try again! *\nPublished: ";
                getline (cin, Book.published);
            }
			cout<<"\nBook's ISBN: ";
			getline (cin,Book.isbn);
			while ((Book.isbn.size ()>2) || (Book.isbn.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nISBN";
				getline(cin,Book.isbn);
			}
			cout<<"\nHow Many Copies of Book: ";
			getline (cin,Book.copies);
			while ((Book.isbn.copies ()>2) || (Book.isbn.find_first_of("1234567890")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nISBN";
				getline(cin,Book.isbn);
			}
		char date [10];
		_strdate(date);
		Book.date = date;
				}
	cout<<"\nSave record?\n<1=yes, 0=no>"<<endl;
	cin>>confirm;

	if (confirm == 1)
	{
		fs = new fstream (BOOK_FILE_NAME, ios::out | ios::app | ios::binary);
		if (!fs)
		{
			cout<<"\n Can't open or create'"<<BOOK_FILE_NAME<<"'file"<<endl;
			system("pause");
			break;
		}
		fs->write ( (char *) & Book, sizeof (Book));
		closefile(fs);
	}
		cout<<"\nRecord Added."<<endl;
		system("pause");
		goto Mainpage;
	
	
	break;
	}
	
	case '2':
		{
		cout << "search"<<endl;
		cout<<"please enter Book's ID: ";
		cin >>id;
		fs= new fstream ( BOOK_FILE_NAME, ios::is | ios::out | ios::binary);
		if (!fs)
		{
			cout<<"\nCan't open or create '"<<BOOK_FILE_NAME<<"'File"<<endl;
			system("pause");
			break;
		}
		recs_num= -1;
				while (fs->read((char*) & Book,sizeof(Book)))
		{
			recs_num++;
			if ( Book.id==id && !Book.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\nBook Does not Exist in the Librery"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}
					  cout << "\n\n";
					  cout << "Book's ID\t\t: " << Book.ID << '\n';
					  cout << "Book's Name\t\t: " << Book.name << '\n';
					  cout << "Book's Author\t\t: " << Book.author << '\n';
					  cout << "Book's Publisher\t: " << Book.publisher << '\n';
					  cout << "Book's Category\t\t: " << Book.category << '\n';
					  cout << "Year Publisher\t\t: " << Book.publisher << '\n';
					  cout << "Book's ISBN\t: " << Book.isbn << '\n';
					  cout << "Number of Copies\t: " << Book.copies << '\n';
					  cout << "Added Date\t: " << Book.date << '\n';

				  
                              
        system("pause");
		goto MainPage;
		break;
                 
}
	case '3':
		{
			cout<<"Edit"<<endl;
			cout<<"please enter BOOK's ID: ";
			cin >>id;
			fs= new fstream ( BOOK_FILE_NAME, ios::is | ios::out | ios::binary);
			if (!fs)
				{
					cout<<"\nCan't open or create '"<<BOOK_FILE_NAME<<"'File"<<endl;
					system("pause");
					break;
		}
		recs_num= -1;
		while (fs->read((char*) & Book,sizeof(Book)))
		{
			recs_num++;
			if ( Book.id==id && !Book.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\nBook Does Not Exist in The Librery"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}
		cout<<"\n Enter Book's NAME: ";
			cin.get();
			getline(cin,Book.name);
			while (Book.name.size ()>2 || (Book.name.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops)
			{
				cout<<"\n* Invalid input! Please enter again!*\nNAME: ";
				getline(cin,Book.name);
			}
			cout<<"\nBook Author:";
			cin>>Book.author;
			while ((Book.author.size ()>2) || (Book.author.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nAuthor";
				getline(cin,Book.author);
			}
			cout<<"\nBook's Publisher: ";
			getline (cin,Book.publisher);
			while ((Book.publisher.size ()>2) || (Book.publisher.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nPublisher";
				getline(cin,Book.publisher);
			}
			cout<<"\nBook's Category: ";
			getline (cin,Book.category);
			while ((Book.category.size ()>2) || (Book.category.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nPublisher";
				getline(cin,Book.category);
			}
			cout<<"\nYear Book was Published: ";
			cin >> Book.published;
			while ((Book.published.size() >2) || (Book.published.find_first_of( "0123456789" ) == string::npos))
            {
                cout << "Invalid input! Please try again! *\nPublished: ";
                getline (cin, Book.published);
            }
			cout<<"\nBook's ISBN: ";
			getline (cin,Book.isbn);
			while ((Book.isbn.size ()>2) || (Book.isbn.find_first_of("qwertyuiopasdfghjklzxcvbnm")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nISBN";
				getline(cin,Book.isbn);
			}
			cout<<"\nHow Many Copies of Book: ";
			getline (cin,Book.copies);
			while ((Book.isbn.copies ()>2) || (Book.isbn.find_first_of("1234567890")== string::nops))
			{
				cout<<"\n *Invalid input!please enter again! *\nISBN";
				getline(cin,Book.isbn);
			}
		char date [10];
		_strdate(date);
		Book.date = date;


		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 '4':
			
	{
		cout << "delete"<<enld;
		cout<<"please enter Book ID: ";
		cin >>book.id;
		fs= new fstream ( BOOK_FILE_NAME, ios::is | ios::out | ios::binary);
		if (!fs)
		{
			cout<<"\nCan't open or create '"<<BOOK_FILE_NAME<<"'File"<<endl;
			system("pause");
			break;
		}
		recs_num= -1;
				while (fs->read((char*) & Book,sizeof(Book)))
		{
			recs_num++;
			if ( Book.id==id && !Book.deleted)
				break;
		}
		if (fs->eof())
		{
			cout<<"\n Book does not exist in this Librery"<<endl;
			closeFile(fs);
			system("pause");
			goto MainPage;
		}
		book.deleted = 1;
		fs->seekp ( sizeof(Book) * recs_num, ios::beg);
		fs->write ( (char*) &Book, sizeof(Book));
		closeFile(fs);
		deletion = true;
		cout<<"\nRecord is deleted."<<endl;
		system("pause");
		got MainPage;
		break;
}
case 5:
	{
		cout<<"Display Existing Records"<<endl;
		fs = new fstream ( BOOK_FILE_NAME, ios::in | ios::binary );
		if (!fs)
		{
			cout<<"caanot open'"<<BOOK_FILE_NAME<<"'file."<<endl;
			system("pause");
			break;
		}
		while (fs->read ( (char *) &Book, sizeof(Book) ))
		{
			if ( !Book.deleted )
			{
					cout << "\n\n";
					cout << "Book's ID\t\t: " << Book.ID << '\n';
					cout << "Book's Name\t\t: " << Book.name << '\n';
					cout << "Book's Author\t\t: " << Book.author << '\n';
					cout << "Book's Publisher\t: " << Book.publisher << '\n';
					cout << "Book's Category\t\t: " << Book.category << '\n';
					cout << "Year Publisher\t\t: " << Book.publisher << '\n';
					cout << "Book's ISBN\t: " << Book.isbn << '\n';
					cout << "Number of Copies\t: " << Book.copies << '\n';
					cout << "Added Date\t: " << Book.date << '\n';
			}
		}
		closeFile(fs);
		system ("pause");
		goto MainPage;
		break;

case '7':
	{
		if (deletion)
		{
			cout << "Updating" << BOOK_FILE_NAME << " File..." <<endl;
			fs = new fstream( BOOK_FILE_NAME, ios::in | ios::binary );
			if (!fs)
			{
				cout << " Can not Open "<< BOOK_FILE_NAME << "File, then Updating is incomplete."<<endl;
				system("pause");
				system( "cls" );
				return 1;
			}
			fs1 = new fstream( "temp", ios::out | ios::binary );
			if (!fs1)
			{
				cout<< "Unable to create temp file. Updating was incomplete ."<<endl;
				system("pause");
				system("cls");
				return 1;
			}
			while (fs->read ( (char *) &Book, sizeof(Book)))
				if ( !Employee.deleted )
					fs1->write( (char *) &Book, sizeof(Book) );
			closeFile(fs);
			closeFile(fs1);
			if( remove( BOOK_FILE_NAME ) == -1)
			{
				cout<<"\n Can not delete"<< BOOK_FILE_NAME <<"file, updating is incomplete."<<endl;
				system("pause");
				system( "cls" );
				cout << "\n\n\n\n\n";
				cout << "\t\t*************************************" <<endl;
				cout << "\t\t**                                 **" <<endl;
				cout << "\t\t**            Thank You            **" <<endl;
				cout << "\t\t**            for using            **" <<endl;
				cout << "\t\t**       The Librery System        **" <<endl;
				cout <<"\t\t**                                  **" <<endl;
				cout <<"\t\t**************************************" <<endl;
				cout <<"\n\n\n\n";
				return 1;
			}
			struct stat st;
			int res = stat ( "temp", &st);
			if (st.st_size == 0)
				remove ( "temp");
			else
				if (rename( "temp",BOOK_FILE_NAME) )
				{
				cout << "Canot rename temp file and update was incomplete"<<endl;
				system("pause");
						
				cout << "\n\n\n\n\n";
				cout << "\t\t*************************************" <<endl;
				cout << "\t\t**                                 **" <<endl;
				cout << "\t\t**            Thank You            **" <<endl;
				cout << "\t\t**            for using            **" <<endl;
				cout << "\t\t**       The Librery System        **" <<endl;
				cout <<"\t\t**                                  **" <<endl;
				cout <<"\t\t**************************************" <<endl;
				cout <<"\n\n\n\n";
				return 1;
				}
				cout<< "\nDatabase Update compleded."<<endl;
				system("pause");
		}
				system( "cls" );
				cout << "\n\n\n\n\n";
				cout << "\t\t*************************************" <<endl;
				cout << "\t\t**                                 **" <<endl;
				cout << "\t\t**            Thank You            **" <<endl;
				cout << "\t\t**            for using            **" <<endl;
				cout << "\t\t**       The Librery System        **" <<endl;
				cout <<"\t\t**                                  **" <<endl;
				cout <<"\t\t**************************************" <<endl;
				cout <<"\n\n\n\n";
				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;
	}
		{
			fs->close();
			delete fs;
			fs = NULL;
		}
		bool isFileExist( const char * file_name)
		{
			struct stat st;
			int res = stat ( file_name, &st );
			return ( res == 0);
		}

and the errors

Error	5	fatal error C1903: unable to recover from previous error(s); stopping compilation	Line	142
Error	1	error C3861: 'passget': identifier not found						Line	42
Error	2	error C3861: 'passget': identifier not found						Line	57
Error	4	error C2065: 'nops' : undeclared identifier						Line	142
Error	3	error C2039: 'nops' : is not a member of 'std::basic_string<_Elem,_Traits,_Ax>'		Line	142
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.