Question: In this c++ coding, I put 20 as the limit. But it seems like did not function, if I put 20 input, it still display
In this c++ coding, I put 20 as the limit. But it seems like did not function, if I put 20 input, it still display . Please fix my errors so it will display " exceed the limit" in coding.
******Employee.cpp*****
#include
Employee::Employee(){} Employee::~Employee() {} Employee emp[20], tempemp[20], sortemp[20], sortemp1[20],temp[20]; int num, i, j,jobcode; bool sorted;
void Employee::login() { system("COLOR 0A"); string pd, password = "1"; string un, username = "q"; bool loginSuccess = false; int att = 0; while(att<3) { cout << "Username : "; cin >> un; cout << "Password : "; cin >> pd; if (username == un && password == pd) { cout << " -------------------- "; cout << "Login Successful" << endl; cout << "-------------------- "; loginSuccess = true; break; } else { cout << " ------------------------ "; cout << "Invalid ID or PASSWORD !" << endl; cout <<" Please try again you have maximum 3 attempt only " << endl; att++; } if (att == 3) { cout << "You have reach the limit attempt and this program will exit " << endl; exit(-99); } } system("pause"); } void Employee::menu() { system("cls"); cout << " "; cout<<(" ***** Employees Management System 1.0 ***** ")<
void Employee::build() { cout<< " Build The Table"< void Employee::display() { system("cls"); cout<<" ********Display The Table********"< void Employee::add() { system("cls"); int i = num; num += 1; cout<<("Insert New Record")< void Employee::search() { system("cls"); cout<<("Welcome To Search Of Employee Database ")< sortemp1[i] = sortemp1[j]; sortemp1[j] = temp[i]; } } } for (i = 0; i <= num - 1; i++) { cout << " Name Code Designation Years(EXP) Age "< *****MainEmployee.cpp**** #include void main() { int option; Employee m; m.login(); m.menu(); cout << " \t\t Select Your Option Please ====> "; cin >> option; while (option != 8) { switch (option) { case 1: m.build(); break; case 2: m.display(); break; case 3: m.add(); break; case 4: m.deletes(); break; case 5: m.edit(); break; case 6: m.search(); break; case 7: m.sort(); break; case 8: exit(0); cout << "invalid selection" << endl; } m.menu(); cout << " \t\t Select Your Option Please ====> "; cin >> option; } return; } ******Employee.h*** #ifndef EMPLOYEE_H #define EMPLOYEE_H const int max = 20; class Employee { public: Employee(); ~Employee(); void login(); void menu(); void build(); void display(); void add(); void deletes(); void edit(); void search(); void sort(); private: char name[20]; long int code; char designation[20]; int exp; int age; int num; }; #endif
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
