Saturday, January 26, 2013

C++ Program to show Fibonacci Series

Fibonacci


Write a program , that prints all the Fibonacci numbers ,which are smaller than or equal to a number k(k≥2) ,which was entered by the user.
The Fibonacci numbers are a sequence of numbers,where then-th number of Fibonacci is defined as:
Fib(0)=0,
Fib(1)=1,
Fib(n)=Fib(n-1)+Fib(n-2) Usage :> Input of k:21 > Fibonacci numbers<=21:01123581321

Solution-


#include<iostream>

using namespace std;


 int main (void)
{
     
    int r=0,a=0,n,b=1,i,c;
    char redo;
    do
    {
         a=0;
         b=1;
     cout<<"enter the the value of n:";
     cin>> n;
     if(n>100){
     cout<<"enter some lessor value"<<endl;
     }
     else{
     cout<<a<<endl;
     for (i=0;i<=n;i++)
     {
     c=a+b;
     a=b;
     b=c;
     cout<<"serial no."<<i+1<<"==";
     cout<<a <<endl;
}     
      cout<<"enter y or Y to continue:";
           cin>>redo;
           cout<<endl<<endl;
}
           }
           while(redo=='y'||redo=='Y');
    
   
   system("pause");
    return 0;
}  


   

C++ program Fibonacci series



---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------




---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------


Fibonacci sequence in c++
Fibonacci Series - C / C++
c++ program to generate Fibonacci series
Fibonacci numbers c++
C++ Fibonacci program
How do i write a c++ code for a fibonacci sequence
Write the program for fibonacci in c++?
C++ Program to print the Fibonacci Sequence!
Write a program to implement the Fibonacci series

C++ program for Calculation of the surface and the volume of a cone

C++ program for Calculation of the surface and the volume of a cone

Write a program that calculates the volume of a solid cone.The formula is: volume=(radius²height)/3
Read in the values for the parameters height and radius(as floating point numbers).
Then the program should calculate the volume considering the following restriction :radius and height must be greater than0
If the user types in a nin correct value for one of the variables ,the program should print out an error message and quit.Otherwise,it displays the result.

Solution-


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    double r,h,a;
    cout<<"enter the radius="<<endl;
    cin>>r;
     cout<<"enter the hight="<<endl;
    cin>>h;
    if (r==0 || h==0)
    {
             cout<<"invalid operation"<<endl;
             
             }
    if(r!=0 && h!=0)
    {
            a=(3.14*r*r*h)/3;
            cout<<"the area="<<a<<endl;
            }    
            system("pause");
            return 0;
            
            
    }


---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------

Write a C++ program to Solve Quadratic equation

Quadratic equation

Write a program that calculates the real solution of the quadratic equation ax²+bx+c=0
Read in the values for the parameters a,b,c(type float).
Then the program should calculate the solution considering the following circumstances:
a=0andb=0=>Not a valid equation
a=0 and b≠0 => x=-c/b
b² -4ac < 0 => Not a Real Solution
b² -4ac >0 => x1= (-b+√(b² -4ac))/2a , x1= (-b -√(b² -4ac))/2a
Hint:The c++ function for √x is sqrt(x).
To use this function you need to includemath.has a header file#include<math.h>

Solution-


#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
    double a,b,c,x1,x2;
    char x;
    cout<<"enter the value of a=";
    cin>>a;
     cout<<"enter the value of b=";
    cin>>b;
     cout<<"enter the value of c=";
    cin>>c;
     cout<<"the quadratic equation is"<<a;
     cout<<"*x*x+"<<b;
     cout<<"*x+"<<c<<endl;
    if
        
                    (a==0 && b==0)
        cout<<"not a valid equation";
          if
        
                    (a==0 && b!=0)
                    {
                          x1=-(c/b);
                          
                 
    cout<<endl;
    cout<<"root="<<x1;
    cout<<endl; 
}
     if ((b*b-4*a*c)>0)
    {
        x2=(b*b)-(4*a*c);
         x1=-b+sqrt(x2);
         cout<<"root="<<x1<<endl;
         }
     if ((b*b-4*a*c)<0)
     {
    cout<<"not a real root"<<endl;
}
    system("pause");
    return 0;
}

Write a C++ program to Solve Quadratic equation





---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------




---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------



Write a C++ program that solves quadratic equation to find its roots
Write a c++ program to solve quadratic equation
C++ quadratic equation solver
Quadratic Equation: C++ Source Code
program to find the roots of a quadratic equation
C program for solving quadratic equation
How do you write a c program to solve quadratic equation

C++ Mini-Project: Human Resource Management Program

Exercise 9)

Mini-Project: Human Resource Management Program 
Consider that you want to write a program for the company called XYZ which produces medical instruments. This company is divided into 2 departments: Manufacturing Department (MD) and Human Resource Management department (HRM). You are requested to write a program for HRM department of company XYZ including the maximum number of 100 employees.  shows main menu for your program. You are allowed to re-design this menu but with the same functionalities.  Note that after each step you should come back to main menu.

Welcome to Human Resource Management (HRM) Software of Company XYZ. To do specific task please choose one of the following commands.
1. Add new employee
2. Delete employee information
3. Update employee information
4. Make reports based on specific field
5. Search employee
6. Quit
Please enter the related number of your requested command?

You should use class definition Person (See Figure 3.2) and class definition HRM (See Figure 3.3). Note that in class Person, setting the values for all fields is not possible. You have to calculate the value for the field “Salary” after initializing the fields “WorkingHours” and “CostPerHour” by user. For those which the set function works, the validity of the entered data should be checked. For example, negative values for fields “Salary”, ”WorkingHours” and ”CostPerHour” are not accepted. As another example the field “WorkingHours” should be between 1 and 60.



Class Person should include following private fields:
 FirstName (String)
 LastName (String)
 PersonalID (Integer)
 Salary (Double)
 WorkingHours (Double)
 CostPerHour (Double)
Class Person should have public member functions for setting and getting the private fields.
Member functions should have the following naming style:
 set_FieldName()
 get_FieldName()




The field “PersonalID” of class Person should be unique and auto-increment with the initial value of 8921001 for the first employee. It means that user should not enter the value for “personalID”.

Class HRM should include following private fields:
 Array of employees with the type Person (Private)
 The actual amount of staff which is stored in Array of employees(private)
Class HRM should include following public member functions:
 AddPerson()
 DeletePerson(…)
 UpdatePerson(…)
 ReportList(…)
 SearchPerson(…)
Please note that you need to check the actual amount of employees and in case of reaching to the number 100 for the total number of employees you should give proper message. For the actual amount of employees you should not enter the value yourself and your program should calculate automatically the amount while entering or deleting the information of an employee.
Based on the description of the program, you need to define some arguments for functions DeletePerson(…), UpdatePerson(…), ReportList(…), SearchPerson(…) instead of (…).


1. AddPerson()
This function allows users to enter the related information of employees in class HRM. During the initialization step your program should get the working hours per week (e.g. 35) for the employee and the payment for his/her work per hour. Then, you should calculate the total salary for him/her per year. You should consider 52 working weeks for one year in your calculations.  shows the sample output of this function.


Please enter the first name of an employee? Alex
Please enter the last name of an employee? Peterson
How many hours a week is his/her work? 35
How much per hour is his/her salary? 20
The employee with the following information has been added to the system:
First Name Last Name Personal ID Salary per year (Euros)
-------------- -------------- -------------- ---------------------------
Alex Peterson 8921001 36400
Do you want to add another employee (y/n)? n

2. DeletePerson(…)
This function allows user to delete the staff information. Since the only unique value in the list of employees is “Personal Number”, therefore delete function should be based on this field. Note that in order to enter the correct personal number of employee you need to find his/her personal ID using the function SearchPerson(…).

Please enter the personal number of an employee? 2425374
Sorry, there is not any employee with requested personal number. Do you want to repeat delete by entering the new personal number (y/n)? y
Please enter the personal number of an employee? 8921002
Do you really want to delete employee Michael Jackson (y/n)? y
The employee Michael Jackson has been deleted. Do you want to repeat delete by entering the new personal number (y/n)? n

3. UpdatePerson(…)
This function allows user to make changes in some fields of staff information. The field “Personal Number” is not allowed to be changed. For example, if user wants to change the number of working hours for specific employee, he should use this function. Since the only unique value in the list of employees is “Personal Number”, therefore update function should be based on this field. You could use the Figure 3.6 as a basic idea for your development. Note that during the update process, if user changes fields “working hours” or “salary of one hour work”, you need to re-calculate yearly salary based on new values and update related fields.

Please enter the personal number of an employee? 2425374
Sorry, there is not the employee with requested personal number. Do you want to repeat update by entering the new personal number (y/n)? y
Please enter the personal number of an employee? 8921001
Please enter the related number of field which you would like to update
(1. First name, 2. Family name, 3. Working hours per week, 4. Payment for one hour)? 4
Please enter new payment for one hour in Euros for Mr. Peterson? 25
Do you want to update any other field (y/n)? n
The information for Mr. Peterson has been updated. Do you want to repeat update by entering the new personal number (y/n)? n





4. ReportList(…)
In this function, user can choose a specific field to make reporting. These fields can be “Family Name” or “Salary”. You could use Figure 3.7 as a basic for your development. The list will be sorted ascending based on the requested field.


Please enter the related number of the field which you would like to sort the list based on it.
(1. Family name, 2.Salary)? 2
Following is the result:
First Name Family Name Personal Number salary (Euro)
-------------- ---------------- ---------------------- ----------------
Alex Peterson 8921001 45500.00
Martin Klein 8921003 81900.00
Sarah Müller 8921004 105300.00
Sabine Schepper 8921005 129386.40
Please enter any key to come back to main menu.


5. SearchPerson(…)
In this function, user can find specific people using chosen fields. These fields can be “Family Name” or “Salary”. You could use Figure 3.8 as a basic for your development.
By using salary as a search field, user should define minimum and maximum values for search. As a result he/she will get the list of employees who their salary is between requested Min_Salary and Max_salary. For searching the employee with specific amount of salary, user should define same Min_Salary and Max_Salary values.
By using the “Family Name” as a search field user will get the list of employees who their family name is equal to requested family name.

Search is based on two different fields (1.family name, 2.Salary), please enter your choice? 2

Please define your search range for salary of employees (S_min, S_max).
What is minimum salary for search (S_min)? 60000
What is maximum salary for search (S_max)? 110000
Following is the list of employees for your defined search fields:
First Name Family Name Personal Number salary (Euro)
-------------- ---------------- ---------------------- ----------------
Martin Klein 8921003 81900.00
Sarah Müller 8921004 105300.00
Do you want to do new search (y/n)? y
Search is based on two different fields (1.family name, 2.Salary), please enter your choice? 1
Please enter the family name of employee? Peterson
Following is the list of employees for your defined search fields:
First Name Family Name Personal Number salary (Euro)
-------------- ---------------- ---------------------- ----------------
Alex Peterson 8921001 45500.00
Do you want to do new search (y/n)? n

Solution-


#include<iostream>
#include<math.h>
#include<cstdlib>
#include<string>

using namespace std;



class Person
{
     private :   
         
    string FirstName;     // student name, max 49 characters
    string LastName;      // student family name
    int PersonalID ;      
    double Salary ;
    double WorkingHours ;
    double CostPerHour ; 
      
        public :  
              
               void set_FieldName();
                void get_FieldName();
                void gett_FieldName();
                void set_PersonalID();
               void set_Name();
               void LastNamesortList();
               void in_FirstName();
               void in_FamilyName();
               void in_Workinghour();
               void in_Costperhour();
                               };
                                    

class HRM
{
     private :  
             
               
     Person e[100] ;      
       Person temp[100]; 
    public : 
            
      void AddPerson();
      void DeletePerson();
      void SearchPerson();
      void UpdatePerson();
      void ReportList();
 
};

////global variables declared
int n=0,i=0,x=8248001,y[100];
bool flag=0;
int  z[100];
string h[100];
double sal[100];
int check=0;


/////////////////////////////////////////////////////////////////////
//      Definition of the AddPerson() method of the Company class
//      This method will add an employee to the Company class instance. 
//      The attributes of the employee should be those of the user's 
//      own choosing.

void ::HRM::AddPerson() {
       
        int x;
        char redo;
         
         do
           {
         n++;
        e[i].set_FieldName();
        i++;
                
                     cout<<"\nThe employee with the following information has been added to the system:"<<endl;
                     cout<<"\nFirst Name       Last Name       Personal ID         Salary per year (Euros)"; 
                     cout<<"\n--------------   --------------  ------------       -------------------------"<<endl; 
                     //cout<<"naaaaaaaaaaaam"<< n<<endl;
           for(int i=0; i<n; i++){      
                                 e[i].get_FieldName();
                                 }  
                                 
                                 
        cout<<"do u wont to add another employee"<<endl;  
         cin>>redo;
        }
        while((redo=='y'||redo=='Y'));
        
        }
        
        
        
        /////////////////////////////////////////////////////////////////////
//      Definition of the DeletePerson() method of the Company class.
//      This method will delete the employee of the user's choosing from
//      the Company class instance.
        
        void HRM::DeletePerson() {
        //      Show all of the current employees
        //      Ask the user the ID of which employee that they wish to
        //      delete.
        
        int empId;
        bool lol;
        char redo1,redo2;
        lol =false;
         lebel:
        cout << "ID of employee to remove: ";
      
         while(!(cin>>empId))  //Reciving vaiables from input : is it no/character ?
      {
                   cout << "Please  enter a number!  Try again: ";
                   cin.clear ();   
                  cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                           // whichever comes first.
      }
      
       
        
       
        for ( i = 0; i < n; ++i) {
           
                
                if (y[i]==empId) {     
                    e[i]=e[i+1];
                   lol=true;
                     e[i].set_Name();
      cin>>redo2;
       if(redo2=='Y'||redo2=='y'){
        int a;
        a=n;                           
                                  
                                   cout<<"\nThe employee with the following information has been added to the system:"<<endl;
 cout<<"\nFirst Name       Last Name       Personal ID         Salary per year (Euros)"; 
 cout<<"\n--------------   --------------  ------------       -------------------------"<<endl;
        for(int i=0; i<a; i++){
               
                              e[i].get_FieldName();
                              cout<<"hahahahah="<<n<<endl;
      a--;
      n=a;
      n++;
                                } 
       
                                            
                                              ///      goto lebel1;
                                                    }
                          
     cout <<endl;   
                     
                           //Delete function
                                  }
                 
                          }
        

     
          
        
         if (lol==false) {
             cout<<"Sorry, there is not any employee with requested personal number."
                 <<" Do you want to repeat delete by entering the new personal number (y/n)?:";
             cin>>redo1;
 if(redo1=='Y'||redo1=='y'){
                              goto lebel;
                              cout<<endl<<endl;
                            }
                 }
        
      
    

        //      Delete the chosen employee from the array of employees
        //      as represented in this class. 

        // Actually remove the entry from memory so as to not leak objects
        //nextIndex--;
        

}
/////////////////////////////////////////////////////////////////////
//      Definition of the UpdatePerson() method of the Company class
//      This method will modify an attribute of the employee in 
//      the Company class instance. The employee and attribute should be
//      ones of the user's own choosing.
void HRM::UpdatePerson(){
     
        int empId;
        char redo1,redo2;
        
         lebel:
               cout << "ID of employee to modify data: ";
    
         while(!(cin>>empId))  //Reciving vaiables from input : is it no/character ?
      {
               cout << "Please  enter a number!  Try again: ";
               cin.clear ();   
               cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                  // whichever comes first.
      }
       
       
        
       
      int flag1=0;
for (int i = 0; i < n; ++i) {
            
                if (y[i]!=empId) {    
                flag1++;
         
                                 }
                          } 
                        /*  if (flag1==n){
                          
                         // cout<<" not     matching="<< y[i];
cout<<"Sorry, there is not any employee with requested personal number. Do you want to repeat delete by entering the new personal number (y/n)?:";
                     cin>>redo1;
                          if(redo1=='Y'||redo1=='y'){
                          goto lebel;
                            }
                          } */         

     cout <<endl;   
     lebel1:
        
       for (int i = 0; i < n; ++i) {
           
                
                if (y[i]==empId) {
                   
                   cout<<"matching="<< y[i];      
                 
       flag=true;
       int choice = 0;
       char redo;
       
        do {
                cout << endl << endl;
               cout << "Please enter the related number of field which you would like to update" << endl;
                cout <<"1. First name" << endl;
               cout << "2. Family name" << endl;
               cout << "3. Working hours per week" << endl;
               cout << "4. Payment for one hour" << endl;
               cout << std::endl;

                cin >> choice;
                if (choice == 1) {
                        cout << " First name: ";
                       e[i].in_FirstName();
                }
                else if (choice == 2) {
                       cout << " Family name: ";
                       e[i].in_FamilyName();
                }
                else if (choice == 3) {
                        cout << " Working hours per week: ";
                         e[i].in_Workinghour();
                }
                else if (choice == 4) {
                        cout << " Payment for one hour: ";
                         e[i].in_Costperhour();
                }
                cout<<"Do you want to update another field (Y/N)=";
                cin>>redo;
        } while (redo=='y'||redo=='Y');
        }
        }
       int a;
        a=n;
         cout<<"\nThe employee with the following information has been added to the system:"<<endl;
         cout<<"\nFirst Name       Last Name       Personal ID         Salary per year (Euros)"; 
         cout<<"\n--------------   --------------  ------------       -------------------------"<<endl;
        for(int i=0; i<a; i++){
        e[i].get_FieldName();
        
        cout<<"hahahahah="<<n<<endl;
     
        } 
          }



void ::Person::in_FirstName()
{
     cin>>FirstName ;
}
void::Person::in_FamilyName()
{
 cin>>LastName;
}
void::Person::in_Workinghour()
{
  cin>>WorkingHours;
  Salary=WorkingHours*CostPerHour*52;
}
void::Person::in_Costperhour()
{
  cin>>CostPerHour;
  Salary=WorkingHours*CostPerHour*52;
}







void HRM::ReportList() {
     
 char op;
 bool doMore;
 cout<<"\nPlease enter the related number of the field which you would like to sort the list based on it.\n(1. Family name, 2.Salary)?\n"<<endl;                       
 //cin>>op;
    while(!(cin>>op))  //Reciving vaiables from input : is it no/character ?
      {
                   cout << "Please  enter a number!  Try again: ";
                   cin.clear ();   
                  cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                           // whichever comes first.
      }
      

         switch(op)
         {
           case '1':
                    cout<<"\nSorting based on Family Name\n"<<endl;
                    for(int i=0;i<=n;i++)
                    {
                     for(int j=i+1;j<=n-1;j++)      
                     {  
                        if(h[i]>h[i+1])
                        {
                           temp[i]=e[i];                       
                           e[i]=e[j];
                           e[j]=temp[i];
                        }
                     }
                    }
                    
                    
                   for(int i=0;i<n;i++)
                   {
                   e[i].get_FieldName();
                   }
                     cout<<"\nsorted\n";
                   
                    break;
           case'2':
                    cout<<"\nSorting based on Salary\n"<<endl;
                    for(int h=0;h<n;h++)
                    {
                       for(int q=h+1;q<n;q++)    
                       {     
                    if(sal[h]>sal[h+1]);
                     {
                           temp[h]=e[h];                       
                           e[h]=e[q];
                           e[q]=temp[h];
                        }
                     }
                    }
                   for(int j=0;j<n;j++)
                   {
                   e[j].get_FieldName();
                   }
                    cout<<"\nsortedlist is printed above\n";
                    
                    break;        
           }
 }
      
      

void HRM::SearchPerson(){
     int c;
     char redo1;
     string familyname;
     double min,max;
      do{  
      cout<<"Search is based on two different fields (1.family name, 2.Salary), please enter your choice?="<<endl;
      //cin>>c;
       while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
      {
                   cout << "Please  enter a number!  Try again: ";
                   cin.clear ();   
                  cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                           // whichever comes first.
      }
      
      
      if(c==2)
      
      {
              cout<<"Please define your search range for salary of employees ."<<endl;
              cout<<"What is minimum salary for search (S_min)?="<<endl;
              //cin>>min;
               while(!(cin>>min))  //Reciving vaiables from input : is it no/character ?
      {
                   cout << "Please  enter a number!  Try again: ";
                   cin.clear ();   
                  cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                           // whichever comes first.
      }
              cout<<"What is maximum salary for search (S_max)?="<<endl; 
              //cin>>max;
               while(!(cin>>max))  //Reciving vaiables from input : is it no/character ?
      {
                   cout << "Please  enter a number!  Try again: ";
                   cin.clear ();   
                  cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                           // whichever comes first.
      }
                    int a;
                    a=n;
         cout<<"\nThe employee with the following information has been added to the system:"<<endl;
 cout<<"\nFirst Name       Last Name       Personal ID         Salary per year (Euros)"; 
 cout<<"\n--------------   --------------  ------------       -------------------------"<<endl;
              for(int i=0; i<n; i++) {
            
                
                   if (z[i]>min && z[i]<max) {
                               
                                       cout<<"naaaaaaaaaaaam"<< n<<endl;   
                                       e[i].gett_FieldName();             
                                       cout<<"matching="<< z[i];           
                                           }
                                     } 
       
       
             
       }
       
       else if(c==1)
      {
                    cout<<"Please enter the family name of employee?"<<endl;
                    cin>>familyname;
                    cout<<"\nThe employee with the following information has been added to the system:"<<endl;
                    cout<<"\nFirst Name       Last Name       Personal ID         Salary per year (Euros)"; 
                    cout<<"\n--------------   --------------  ------------       -------------------------"<<endl;
        for(int i=0; i<n; i++) {
           
                
       if (h[i]==familyname) {
                              
                    cout<<"naaaaaaaaaaaam"<< n<<endl;   
                    e[i].gett_FieldName();             
                    cout<<"matching="<< z[i];           
                             }
                                 }
      }
     
      cout<<"\nDo you want to Search any other field (y/n)?\n"<<endl;
               cin>>redo1;
               }while(redo1=='y'||redo1=='Y');
     
     
     }
     

void ::Person::LastNamesortList() {
     int temp2;
     char temp,temp1;
                                }
     
void::Person ::set_Name(){    
               cout<<"Do you really want to delete employee"<<FirstName<<"\t"<< LastName<< "(y/n)?:";   //PersonalID=y[i];
                         }
                              
                              
int k=0;      
void::Person ::set_FieldName(){
             PersonalID=x;
             x++;
             cout<<n;
          cout<<"First Name=";
         
         while(!(cin>>FirstName))  //Reciving vaiables from input : is it no/character ?
      {
                   cout << "Please  enter a string!  Try again: ";
                   cin.clear ();   
                   cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                  // whichever comes first.
      }
                   cout<<"Last Name=";
        
         while(!(cin>>LastName))  //Reciving vaiables from input : is it no/character ?
      {
                   cout << "Please  enter a string!  Try again: ";
                   cin.clear ();   
                   cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                  // whichever comes first.
      }
         
                   cout<<"How many hours a week is his/her work? =";
           ;
         while(!(cin>>WorkingHours))  //Reciving vaiables from input : is it no/character ?
      {
                  cout << "Please  enter a number!  Try again: ";
                  cin.clear ();   
                  cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                  // whichever comes first.
      }
                 cout<<"How much per hour is his/her salary? =";
        
        while(!(cin>>CostPerHour))  //Reciving vaiables from input : is it no/character ?
      {
                 cout << "Please  enter a number!  Try again: ";
                 cin.clear ();   
                 cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                  // whichever comes first.
      }
           
 Salary=WorkingHours*CostPerHour*52;
 z[i]= Salary;
 sal[i]=Salary;
 h[i]=LastName;
 y[k]=PersonalID;

k++;
}

void::Person ::get_FieldName(){              
                cout<<FirstName<<"\t\t"<<LastName<<"\t\t\t"<<PersonalID<<"\t\t\t"<<Salary<<"\t"<<endl;
                              }
                
                
                
void::Person ::gett_FieldName(){            
                cout<<FirstName<<"\t\t"<<LastName<<"\t\t\t"<<PersonalID<<"\t\t\t"<<Salary<<"\t"<<endl;
                               }



int main()
{
//-------defining variables and initializing them-------------    


    HRM info ;
    
   int c;
    char operation,ch;
//--------Printing my name on screen----------------    
    cout<<        "Welcome to the  program 2.1 written by Your Name"<<endl;
    cout<<"**************************************************************************"<<endl;
    cout<<endl<<endl<<endl;
   do
 {
                   
    cout<<"Welcome to Human Resource Management (HRM) Software of Company XYZ.";
    cout<<"To do specific task please choose one of the following commands."<<endl<<endl<<endl;
    cout<<"    1. Add new employee"<<endl;
    cout<<"    2. Delete employee information"<<endl;
    cout<<"    3. Update employee information"<<endl;
    cout<<"    4. Make reports based on specific field"<<endl;
    cout<<"    5. Search employee"<<endl;
    cout<<"    6. Quit"<<endl<<endl;
    
    
       while(!(cin>>c))  //Reciving vaiables from input : is it no/character ?
      {
      cout << "Please  enter a number!  Try again: ";
      cin.clear ();   
      cin.ignore (1000, '\n');  // Skip to next newline or 1000 chars,
                                  // whichever comes first.
      }
      switch(c)
  {
  case 1:
                cout<<"\nEnter the information of the new employee"<<endl;
    info.AddPerson(); 
    break;
  case 2: 
               info.DeletePerson();
               break;
  case 3:
              cout<<"\nEnter an item to deletion";    
              info.UpdatePerson();
              break;
  case 4:
                cout<<"\nEnter an element to search";
    info.ReportList();
    break;
  case 5:
             info.SearchPerson();
            break;
    default :
             cout<<"\nInvalid option try again";
        
  }
       cout<<"\ndo u want to continue";
      cin>>ch;
 }
 while(ch=='y'||ch=='Y');
   
  
    system("pause");
    return 0;
    }





---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ