nicemark 0 Newbie Poster

** hi guys ..
i nid to finish it until tomorrow morning ..
the Admin USERNAME is IT2B and the PASSWORD is MANALO ..
can someone help me here in my HR SYSTEM ..
can you do the edit and delete function for me.
or give me a little idea or sample codes about it ..

i compile it in c++ 6.0 ..
will you run it on your pc/laptop and make a folder then compile ..
to see the fstreaming file that generated ..

also guys, how can i do that ..
for Example ..

*****************************
cout << "Employee ID: ";
cin >> emp;

what i want here is that ..
these name, age, address are the data that will be inside on the employee id ..

cout << "Name: ";
cin >> name;
cout << "Age: ";
cin >> age;
cout << "Address: ";
cin >> address;

*****************************

the array limit is 10 ..

how can i make employee id used to store in an array to make it easy for
me to EDIT and DELETE those data for that particular id ..
hope someone could help me here ..
thank you :(
i am a begginner so i want some guides and help :'(

#include <iostream>
#include <string>
#include <fstream>

using namespace std;

class Employee
{
public:
	string id;
	string name;
	string age;
	string address;

	void Accept()
	{
		system("cls");
		cout << endl << endl << "\t\t\t -------------------------------" << endl;
		cout << "\t\t\t ---->HUMAN RESOURCE SYSTEM<---- " << endl;
		cout << "\t\t\t ---------> EMPLOYEE <---------- " << endl;
		cout << "\t\t\t -------------------------------" << endl;
		cout << endl << "\t\t\t Employee ID: ";
		cin >> id;
		cout << "\t\t\t Name: ";
		cin >> name;
		cout << "\t\t\t Age: ";
		cin >> age;
		cout << "\t\t\t Address: ";
		cin >> address;
	}
};



class Admin : public Employee							// inheritance
{
public:
	string ch;
	string log;
	string pass;
	int choice;
	char func;
	int fyw;
	string text;

	void WriteText()  //injecting the text to file..
	{
	//	string StringToWrite = this->text;
		string EmployeeID = this->id;
		string Name = this->name;
		string Age = this->age;
		string Address = this->address;
	
		ofstream Isulat("IT2B.csv",ios::app);						// injecting the value or text to print
		Isulat << "************************************" << endl;
		Isulat << "Employee ID: " << EmployeeID << endl;
		Isulat << "Name: " << Name << endl;
		Isulat << "Age: " << Age << endl;
		Isulat << "Address: " << Address << endl;
		
		cout << "\t\t\t *************** File written." << endl;
		cout << "\t\t\t ";
		Isulat.close();
	}


	string View()
	{
		string ReadText = "";
		
		ifstream Basahin("IT2B.csv");
		if(Basahin.is_open())
		{
			while(!Basahin.eof())
			{
				getline(Basahin,ReadText,'$');
			}
			Basahin.close();
		}
		else
			cout << "Unable to Open File." << endl;
		return ReadText;
	}

	void Delete()
	{
		ofstream Isulat("IT2B.csv",ios::trunc);						// injecting the value or text to print
		Isulat << " " << endl;
		Isulat << " "  << endl;
		Isulat << " " << endl;
		Isulat << " " << endl;
		Isulat << " " << endl;
		
		cout << "\t\t\t *************** File Deleted" << endl;
		cout << "\t\t\t ";
		Isulat.close();
		ofstream Isulat2("IT2B.csv",ios::app);
		Isulat2.close();
	}



	void AdminFunc()
	{
		while(choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5')
		{
			system("cls");
			cout << endl << endl << "\t\t\t -------------------------------" << endl;
			cout << "\t\t\t ---->HUMAN RESOURCE SYSTEM<---- " << endl;
			cout << "\t\t\t -----------> ADMIN <----------- " << endl;
			cout << "\t\t\t -------------------------------" << endl << endl;
			cout << "\t\t\t\t 1 : DELETE" << endl;
			cout << "\t\t\t\t 2 : UPDATE" << endl;
			cout << "\t\t\t\t 3 : VIEW" << endl;
			cout << "\t\t\t\t 4 : EXIT" << endl << endl;
			cout << "\t\t\t Function You Want to Do: ";
			cin >> fyw;

			system("cls");

			switch(fyw)
			{
			case 1:
				{
				}
			case 2:
				{
					Delete();
				}
			case 3:
				{
					system("cls");
					cout << View() << endl;

					system("pause");
					AdminFunc();
				}
			case 4:
				{
					cout << "\t\t\t  ";
					exit(0);
				}
			}
		}

	}


	
	void Log()
	{
		system("cls");
		cout << endl << endl << "\t\t\t -------------------------------" << endl;
		cout << "\t\t\t ---->HUMAN RESOURCE SYSTEM<---- " << endl;
		cout << "\t\t\t -----------> ADMIN <----------- " << endl;
		cout << "\t\t\t -------------------------------" << endl << endl;
		cout << "\t\t\t  USERNAME: ";
		cin >> log;
		cout << "\t\t\t  PASSWORD: ";
		cin >> pass;

		if(log=="IT2B" && pass=="MANALO")
		{
			cout << endl << "\t\t\t\tACCESS GRANTED!!!" << endl;
			cout << "\t\t\t ";
			system("pause");
			AdminFunc();
		}
		else
		{
			cout << endl << "\t\t    WRONG COMBINATION OF USERNAME AND PASSWORD!!" << endl;
			cout << "\t\t\t ";
			system("pause");
			Log();
		}
	}



	void Front()
	{
		while(choice != '1' && choice != '0')
		{
			system("cls");
			cout << endl << endl << "\t\t\t -------------------------------" << endl;
			cout << "\t\t\t ---->HUMAN RESOURCE SYSTEM<---- " << endl;
			cout << "\t\t\t -------------------------------" << endl << endl;
			cout << "\t\t\t\t[1] : LOG IN" << endl << endl;
			cout << "\t\t\t\t[0] : EXIT" << endl << endl;
			cout << "\t\t\t\t ^Choice: ";
			cin >> choice;

			switch(choice)
			{
			case 1:
				{
					while(func != 'a' && func != 'A' && func != 'm' && func != 'M' && func != 'e' && func != 'E')
					{
						system("cls");
						cout << endl << endl << "\t\t\t -------------------------------" << endl;
						cout << "\t\t\t ---->HUMAN RESOURCE SYSTEM<---- " << endl;
						cout << "\t\t\t -------------------------------" << endl << endl;
						cout << "\t\t\t\t[a] : ADMIN " << endl;
						cout << "\t\t\t\t[m] : MANAGER " << endl;
						cout << "\t\t\t\t[e] : EMPLOYEE " << endl << endl;
						cout << "\t\t\t  Choose Function You Want: ";
						cin >> func;				

						switch(func)
						{
						case 'a': case 'A':
							{
								Log();
							}
						case 'e': case 'E':
							{
								Accept();
								WriteText();
								exit(0);
								
							}
						case 'm': case 'M':
							{

							}
						}
					}
				}
			case 0:
				{
					cout << "\t\t\t   ";
					exit(0);
					break;
				}
			}
		}
	}		
};

void main()
{
	Employee emp;
	Admin mark;

	mark.Front();
}