STAFF PERSONNEL SYSTEM
required to develop a Win32 console application to enter, search, edit and view personnel information of the staff in the company based on different access priority. This application will be used by the Human Resource personnel, staff and the administrator of this application. The main purpose of this application is to store and edit the complete personal record of each staff in the company


One of the most important modules of the staff personnel system is the LOGIN module. Each user of the system has its own user name and password. The administrator of the application has the highest access priority which enables him/her to perform all the functionalities that exist in the application. In addition to that, the administrator is able to register users from the human resource department. The staffs of the company have the lowest access priority that only enables them to view their personal information.
The human resource personnel are allowed to:
Register staff as users of the system
Add, search and edit personal information of staff in the company
Delete record of any staff in the company
The following details of each staff are recorded:
Staff Number
Name
Identification Card (IC) Number
Gender
Designation
Department
Date Joined
Nationality
Religion
Date Of Birth
Marital Status

Each staff has a unique staff number and this will be automatically generated by the system.
Classification of designation for staff is categorised as follows:
Managing Director
Senior Manager
Manager
Senior Executive
Executive
Junior Executive
The category of designation and the related department are determined by you in the system.
The search of any record in the system can be done by using the following categories:
A Staff Number or range of Staff Number
Name
IC Number
Classification
And other categories
If a list of record is displayed after the search, the system should allow fine searching in order to allow only one record to be displayed as the final selection. You should design the system so that the user is able to edit the selective category in the search record. After the edit process is done, the user is prompted for saving purpose.
You should determine the selection in the main menu for each login user. After each final result is displayed, the system should prompt the user whether he/she would like to continue or not.

Nick Evan commented: fail +0
Ezzaral commented: Stop spamming this all over the forums. +0
GrimJack commented: Learn to read instructions - it will ony help you +0

Recommended Answers

All 10 Replies

Don't post your homework in the Geek's Lounge. I have already seen this same question posted in the c++ forum. Show some effort and look for your answers there.

friend i know its my assignment but i am working on it ....jsu want help

i created login but its not working

#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib> // for exit(1);

using namespace std;


void Login();

int main()
{
    Login();
    return 0;
}

void Login()
{
    char login_un[50], login_pw[50], username[50], password[50];
    int c;
    ifstream uin("user.txt");
    ifstream pin("pass.txt");

    cout<<"Main\n\n"
        <<"(1) Login\n"
        <<"(2) Quit\n";
    cin>> c;



    if (c==1)
    {
        uin.getline(username, 50);
        while (strcmp(login_un, username) !=0)
        {
            cout<<"Username: ";
            cin.getline(login_un, 50);
            if (strcmp(login_un, username) ==0) break;
            else
                cout<<"\nInvalid Username.\n";
        }

        pin.getline(password, 50);
        while (strcmp(login_pw, password) !=0)
        {
            cout<<"\nPassword: ";
            cin.getline(login_pw, 50);
            if (strcmp(login_pw, password) ==0) break;
            else
                cout<<"\nInvalid Password\n";
        }

    }

    else if (c==2)
    {
        cout<<"Quitting\n";
        exit(1);
    }
    return;
}

now u see my effort and tell wats wrong in that .......i have to use class and all object oreint in c++

This is not the right place for help with an assignment. Post it on the thread on the c++ forum.

I imagine part of your problem is that you do not read or understand instructions. See, right up there by the 'start new thread' is an instruction that you failed to read and/or understand. If you can't RTFM, how can you possibly expect to finish your homework?

Sorry but no one here accepts clueless n00b as an excuse or reason.

Wrong forum, no code tags and no specific question. Once again, you fail.

#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib> // for exit(1);

using namespace std;

void Login();
int main()
{
Login();
return 0;
}

void Login()
{
char login_un[50], login_pw[50], username[50], password[50];
int c;
ifstream uin("user.txt");
ifstream pin("pass.txt");

cout<<"Main\n\n" <<"(1) Login\n" <<"(2) Quit\n";
cin>> c;

if (c==1)
{
uin.getline(username, 50);
while (strcmp(login_un, username) !=0)
{
cout<<"Username: ";
cin.getline(login_un, 50);
if (strcmp(login_un, username) ==0) break;
else
cout<<"\nInvalid Username.\n";
}

pin.getline(password, 50);
while (strcmp(login_pw, password) !=0)
{
cout<<"\nPassword: ";
cin.getline(login_pw, 50);
if (strcmp(login_pw, password) ==0) break;
else
cout<<"\nInvalid Password\n";
}
}
else if (c==2)
{
cout<<"Quitting\n";
exit(1);
}
}

:) You could use a class to enter the users information into the .txt file, I did that for one of my projects. I don't know why you've got a "break" statement in the IF.

Good luck x

commented: You have to stop giving code to people who show no effort. +0
#include<iostream>
#include<fstream>
#include<string>
#include <cstdlib> // for exit function
#include<iomanip>

using namespace std;

void AddToFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus);
void DeleteTheFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus);   
void genderSex();
void marital_status();
void readFromFile();

class Test{

 public:


 void admin(string user,string pass){
  int sex;
  char select;  
  string name;
  string staffno;
  string ic;
  string gender;
  string designation;
  string department;
  string dateofjoined;
  string nationality;
  string religion;
  string dateofbirth;
  string maritalstatus;

if(user=="admin" && pass=="pass") {

     cout<<"\n\n\t\tWELCOME ADMINISTRATOR";
     cout<<"\n\n1-ADD A RECORD :";
     cout<<"\n\n2-VIEW A RECORD:";

     cout<<"\n\n3-EDIT A RECORD :";
     cout<<"\n\n4-DELETE A RECORD :";
     cout<<"\n\n5-SEARCH THE RECORDS :";
     cout<<"\n\n6-EXIT :";
     cout<<"\n\nSelect [1-6] :";
     cin>>select;

     switch (select){

      case '1':
         cout<<"\t\t\tADD A RECORD :";
         cout<<"you can add a reacord";
         cout<<"\n\nEnter Name :";
         cin>>name;
         cout<<"\n\nEnter Staff Number :";
         cin>>staffno;
         cout<<"\n\nEnter Identification Card (IC) Number :";
         cin>>ic;
         cout<<"\n\nEnter Gender :";
         cout<<"\n\n\n1-Male";
         cout<<"\n\n2-Female";


         cout<<"\n\n\nEnter [1-2] :" ;
         cin>>sex;

         if(sex==1){
          gender="Male";
         }
         else if (sex==2){
          gender="Female";
         }
          else {
            cout<<"Invalid Selection";
            genderSex(); 
          }


         cout<<"\n\nEnter Designation :";
         cin>>designation;
         cout<<"\n\nEnter Department :";
         cin>>department;
         cout<<"\n\nEnter Date Joined :";
         cin>>dateofjoined;
         cout<<"\n\nEnter Nationality :";
         cin>>nationality;
         cout<<"\n\nEnter Religion :";
         cin>>religion;
         cout<<"\n\nEnter Date Of Birth :";
         cin>>dateofbirth;
         cout<<"\n\nEnter Marital Status :";
         cin>>maritalstatus;

        AddToFile(name,staffno,ic,gender,designation,department,dateofjoined,nationality,religion,dateofbirth,maritalstatus);
        cout<<"data saved in file successfully....";       

         break;

         case '2':
         cout<<"\t\t\tVIEW THE RECORDS :"<<endl;
         readFromFile();
         cout<<"Data from file viewed sucsessfully";
         break;
         case '3 ':
         cout<<"\t\t\tEDIT A RECORD:";
         break; 
         case '4':
         cout<<"\t\t\tDELETE A RECORD :";
         break;
         case '5':
         cout<<"\t\t\tSEARCH A RECORD :";
         break;
         case '6':
         cout<<"\t\t\tEXIT :";
         cout<<"Welcome Again";
         break;

         }
      }
      else
         cout<<"invalid username and password";

    }//end if 

   };  //end class


         int main(){

            Test ts;
            string user,pass;
            cout<<"Enter Username : ";
            cin>>user;
            cout<<"\n\nEnter password : ";
            cin>>pass;
            ts.admin(user,pass);
            return 0;  
            }


     void AddToFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus){

     ofstream outdata;
     outdata.open("shashank.doc",ios::app);

     if( !outdata ) { // file couldn't be opened
      cout << "Error: file could not be opened" << endl;
      exit(1);
     }

      outdata << name;
      outdata<<"   "<<  staffno  ;
      outdata<<"   "<<  ic ;
      outdata<<"   "<<  gender  ;
      outdata<<"   "<<  designation  ;
      outdata<<"   "<<  department  ;
      outdata<<"   "<<  dateofjoined  ;
      outdata<<"   "<<  nationality ;
      outdata<<"   "<<  religion  ;
      outdata<<"   "<<  dateofbirth  ;
      outdata<<"   "<<  maritalstatus << endl;
      outdata.close();

    }//end method addtofile


    void readFromFile(){

        char str[2000];
        fstream indata("shashank.doc",ios::in);

        while(!indata.eof()){
           indata.getline(str,2000);
           cout <<str<<endl;
        }
         indata.close();
         cout <<endl;

    }  //end of reading method







     void genderSex(){

         int sex;
         string gender;
         cout<<"\n\n\nEnter [1-2] :" ;
         cin>>sex;

         if(sex==1){ 
          gender="Male";
         }
          else if(sex==2){
           gender="Female";
          }
         else 
         cout<<"Invalid Selection";        

        }//end gender method

how to convert it in class and do inheretence ?????


how to do search and delete a record ???????????????

#include<iostream>
#include<fstream>
#include<string>
#include <cstdlib> // for exit function
#include<iomanip>

using namespace std;

void AddToFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus);
void DeleteTheFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus);   
void genderSex();
void marital_status();
void readFromFile();

class Test{

 public:


 void admin(string user,string pass){
  int sex;
  char select;  
  string name;
  string staffno;
  string ic;
  string gender;
  string designation;
  string department;
  string dateofjoined;
  string nationality;
  string religion;
  string dateofbirth;
  string maritalstatus;

if(user=="admin" && pass=="pass") {

     cout<<"\n\n\t\tWELCOME ADMINISTRATOR";
     cout<<"\n\n1-ADD A RECORD :";
     cout<<"\n\n2-VIEW A RECORD:";

     cout<<"\n\n3-EDIT A RECORD :";
     cout<<"\n\n4-DELETE A RECORD :";
     cout<<"\n\n5-SEARCH THE RECORDS :";
     cout<<"\n\n6-EXIT :";
     cout<<"\n\nSelect [1-6] :";
     cin>>select;

     switch (select){

      case '1':
         cout<<"\t\t\tADD A RECORD :";
         cout<<"you can add a reacord";
         cout<<"\n\nEnter Name :";
         cin>>name;
         cout<<"\n\nEnter Staff Number :";
         cin>>staffno;
         cout<<"\n\nEnter Identification Card (IC) Number :";
         cin>>ic;
         cout<<"\n\nEnter Gender :";
         cout<<"\n\n\n1-Male";
         cout<<"\n\n2-Female";


         cout<<"\n\n\nEnter [1-2] :" ;
         cin>>sex;

         if(sex==1){
          gender="Male";
         }
         else if (sex==2){
          gender="Female";
         }
          else {
            cout<<"Invalid Selection";
            genderSex(); 
          }


         cout<<"\n\nEnter Designation :";
         cin>>designation;
         cout<<"\n\nEnter Department :";
         cin>>department;
         cout<<"\n\nEnter Date Joined :";
         cin>>dateofjoined;
         cout<<"\n\nEnter Nationality :";
         cin>>nationality;
         cout<<"\n\nEnter Religion :";
         cin>>religion;
         cout<<"\n\nEnter Date Of Birth :";
         cin>>dateofbirth;
         cout<<"\n\nEnter Marital Status :";
         cin>>maritalstatus;

        AddToFile(name,staffno,ic,gender,designation,department,dateofjoined,nationality,religion,dateofbirth,maritalstatus);
        cout<<"data saved in file successfully....";       

         break;

         case '2':
         cout<<"\t\t\tVIEW THE RECORDS :"<<endl;
         readFromFile();
         cout<<"Data from file viewed sucsessfully";
         break;
         case '3 ':
         cout<<"\t\t\tEDIT A RECORD:";
         break; 
         case '4':
         cout<<"\t\t\tDELETE A RECORD :";
         break;
         case '5':
         cout<<"\t\t\tSEARCH A RECORD :";
         break;
         case '6':
         cout<<"\t\t\tEXIT :";
         cout<<"Welcome Again";
         break;

         }
      }
      else
         cout<<"invalid username and password";

    }//end if 

   };  //end class


         int main(){

            Test ts;
            string user,pass;
            cout<<"Enter Username : ";
            cin>>user;
            cout<<"\n\nEnter password : ";
            cin>>pass;
            ts.admin(user,pass);
            return 0;  
            }


     void AddToFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus){

     ofstream outdata;
     outdata.open("shashank.doc",ios::app);

     if( !outdata ) { // file couldn't be opened
      cout << "Error: file could not be opened" << endl;
      exit(1);
     }

      outdata << name;
      outdata<<"   "<<  staffno  ;
      outdata<<"   "<<  ic ;
      outdata<<"   "<<  gender  ;
      outdata<<"   "<<  designation  ;
      outdata<<"   "<<  department  ;
      outdata<<"   "<<  dateofjoined  ;
      outdata<<"   "<<  nationality ;
      outdata<<"   "<<  religion  ;
      outdata<<"   "<<  dateofbirth  ;
      outdata<<"   "<<  maritalstatus << endl;
      outdata.close();

    }//end method addtofile


    void readFromFile(){

        char str[2000];
        fstream indata("shashank.doc",ios::in);

        while(!indata.eof()){
           indata.getline(str,2000);
           cout <<str<<endl;
        }
         indata.close();
         cout <<endl;

    }  //end of reading method







     void genderSex(){

         int sex;
         string gender;
         cout<<"\n\n\nEnter [1-2] :" ;
         cin>>sex;

         if(sex==1){ 
          gender="Male";
         }
          else if(sex==2){
           gender="Female";
          }
         else 
         cout<<"Invalid Selection";        

        }//end gender method







    #include<iostream>
#include<fstream>
#include<string>
#include <cstdlib> // for exit function
#include<iomanip>

using namespace std;

void AddToFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus);
void DeleteTheFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus);   
void genderSex();
void marital_status();
void readFromFile();

class Test{

 public:


 void admin(string user,string pass){
  int sex;
  char select;  
  string name;
  string staffno;
  string ic;
  string gender;
  string designation;
  string department;
  string dateofjoined;
  string nationality;
  string religion;
  string dateofbirth;
  string maritalstatus;

if(user=="admin" && pass=="pass") {

     cout<<"\n\n\t\tWELCOME ADMINISTRATOR";
     cout<<"\n\n1-ADD A RECORD :";
     cout<<"\n\n2-VIEW A RECORD:";

     cout<<"\n\n3-EDIT A RECORD :";
     cout<<"\n\n4-DELETE A RECORD :";
     cout<<"\n\n5-SEARCH THE RECORDS :";
     cout<<"\n\n6-EXIT :";
     cout<<"\n\nSelect [1-6] :";
     cin>>select;

     switch (select){

      case '1':
         cout<<"\t\t\tADD A RECORD :";
         cout<<"you can add a reacord";
         cout<<"\n\nEnter Name :";
         cin>>name;
         cout<<"\n\nEnter Staff Number :";
         cin>>staffno;
         cout<<"\n\nEnter Identification Card (IC) Number :";
         cin>>ic;
         cout<<"\n\nEnter Gender :";
         cout<<"\n\n\n1-Male";
         cout<<"\n\n2-Female";


         cout<<"\n\n\nEnter [1-2] :" ;
         cin>>sex;

         if(sex==1){
          gender="Male";
         }
         else if (sex==2){
          gender="Female";
         }
          else {
            cout<<"Invalid Selection";
            genderSex(); 
          }


         cout<<"\n\nEnter Designation :";
         cin>>designation;
         cout<<"\n\nEnter Department :";
         cin>>department;
         cout<<"\n\nEnter Date Joined :";
         cin>>dateofjoined;
         cout<<"\n\nEnter Nationality :";
         cin>>nationality;
         cout<<"\n\nEnter Religion :";
         cin>>religion;
         cout<<"\n\nEnter Date Of Birth :";
         cin>>dateofbirth;
         cout<<"\n\nEnter Marital Status :";
         cin>>maritalstatus;

        AddToFile(name,staffno,ic,gender,designation,department,dateofjoined,nationality,religion,dateofbirth,maritalstatus);
        cout<<"data saved in file successfully....";       

         break;

         case '2':
         cout<<"\t\t\tVIEW THE RECORDS :"<<endl;
         readFromFile();
         cout<<"Data from file viewed sucsessfully";
         break;
         case '3 ':
         cout<<"\t\t\tEDIT A RECORD:";
         break; 
         case '4':
         cout<<"\t\t\tDELETE A RECORD :";
         break;
         case '5':
         cout<<"\t\t\tSEARCH A RECORD :";
         break;
         case '6':
         cout<<"\t\t\tEXIT :";
         cout<<"Welcome Again";
         break;

         }
      }
      else
         cout<<"invalid username and password";

    }//end if 

   };  //end class


         int main(){

            Test ts;
            string user,pass;
            cout<<"Enter Username : ";
            cin>>user;
            cout<<"\n\nEnter password : ";
            cin>>pass;
            ts.admin(user,pass);
            return 0;  
            }


     void AddToFile(string name,string staffno,string ic,string gender,string designation,string department,string dateofjoined,string nationality,string religion,string dateofbirth,string maritalstatus){

     ofstream outdata;
     outdata.open("shashank.doc",ios::app);

     if( !outdata ) { // file couldn't be opened
      cout << "Error: file could not be opened" << endl;
      exit(1);
     }

      outdata << name;
      outdata<<"   "<<  staffno  ;
      outdata<<"   "<<  ic ;
      outdata<<"   "<<  gender  ;
      outdata<<"   "<<  designation  ;
      outdata<<"   "<<  department  ;
      outdata<<"   "<<  dateofjoined  ;
      outdata<<"   "<<  nationality ;
      outdata<<"   "<<  religion  ;
      outdata<<"   "<<  dateofbirth  ;
      outdata<<"   "<<  maritalstatus << endl;
      outdata.close();

    }//end method addtofile


    void readFromFile(){

        char str[2000];
        fstream indata("shashank.doc",ios::in);

        while(!indata.eof()){
           indata.getline(str,2000);
           cout <<str<<endl;
        }
         indata.close();
         cout <<endl;

    }  //end of reading method







     void genderSex(){

         int sex;
         string gender;
         cout<<"\n\n\nEnter [1-2] :" ;
         cin>>sex;

         if(sex==1){ 
          gender="Male";
         }
          else if(sex==2){
           gender="Female";
          }
         else 
         cout<<"Invalid Selection";        

        }//end gender method

And yet again you DO NOT put your code in tags therefor, I cba to even read it let alone begin to try and help! :)

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.