#include #include #include using namespace std; struct Staff { string Account; string Password; string Fullname; int Gender; }; struct ArrayStaff { Staff* staffs; int n; }; bool Compare(string s1, string s2) { if (s1 == s2) return true; return false; } void ReadStaff(ifstream& fin, Staff& a) { fin >> a.Account; fin >> a.Password; fin >> a.Fullname; fin >> a.Gender; } bool StaffLogin(ArrayStaff& a) { ifstream fin; fin.open("Staff.txt"); fin >> a.n; string username; /*for (int j = 0;j < a.n;j++) { ReadStaff(fin, a.staffs[j]); }*/ cout << "Enter user: "; cin >> username; a.staffs = new Staff[a.n]; for (int i = 0;i < a.n;i++) { if (Compare(username, a.staffs[i].Account)==true) { cout << "Enter password: "; if (Compare(username, a.staffs[i].Password) == true) { if (a.staffs[i].Gender == 0) { cout << "WELCOME MISS " << a.staffs->Fullname << endl; return true; } else { cout << "WELCOME MR" << a.staffs->Fullname << endl; } } } } delete[]a.staffs; } int main() { ArrayStaff a; StaffLogin(a); system("cls"); }