Home » C++ » C++ projects » Project on Staff Management
C++ Project on Staff Management
Features
- Input records
- Print all records
- Print by age
- Print by sex count
Please keep this code in only one file i.e main.cpp
Source Code
#include using namespace std; #define PERSONS_LIMIT 50 int countPersons = 0; class Persons{ public: int Id; char Name[20]; int Age; char Dob[20]; char Position[30]; char Gender; }; Persons obj[PERSONS_LIMIT]; void input(){ if(countPersons >obj[countPersons].Id; cout<<"\n Enter Name (20 characters): "; cin>>obj[countPersons].Name; cout<<"\n Enter Age (number): "; cin>>obj[countPersons].Age; cout<<"\n Enter DOB (dd-mm-yy): "; cin>>obj[countPersons].Dob; cout<<"\n Enter Position : "; cin>>obj[countPersons].Position; cout<<"\n Enter Gender (M/F) : "; cin>>obj[countPersons].Gender; countPersons++; } else { cout<<"\n Error : Limit is only " << PERSONS_LIMIT; } } void printAll(){ cout<<"\n **** **** Printing All Records **** ****"; cout<<"\n total number of persons : "< 50) count50plus++; else if(obj[i].Age>40) count40plus++; else lessthen40++; } cout<<"\n Persons more than 50 : "< >choice; switch(choice){ case 1: input(); break; case 2: printAll();break; case 3: printbyAge(); break; case 4: printSexCount(); break; case 0: cout<<"\n thank you for using software !!";break; default: cout<<"\n Error: Invalid Selection"; } } return 0; }