** 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 :'(
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
|
#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();
}
|