#include<iostream>
#include <vector>

struct employee
{
    char name[20];
    float  salary;
    int birthday;
    char sex [10];
};

int main()
{
    employee emp[100];

    {
        int n;
    
        std::cout << "A program for collecting employee information";
    	std::cout << std::endl;
    	std::cout << "And displaying the collected information";
    	std::cout << std::endl << std::endl;
    	std::cout << "How many employees:";
    	std::cin >> n;
    	std::cout << std::endl;

    	std::cout << "Enter the following information:"<<std::endl;
    	std::cout << std::endl;
    
        for(int i=0; i<n; i++)
        {
            std::cout << "Enter information for employee no: " << i;
            std::cout << std::endl;
    
            std::cout<<"Enter the Employee name :" ;std::cin>>emp[i].name;
            std::cout<<"Enter the salary :";std::cin>>emp[i].salary;
            std::cout<<"Enter the birthday :";std::cin>>emp[i].birthday ;
            std::cout<<"Enter the sex :";std::cin>>emp[i].sex;
            std::cout<<std::endl;
        }
    
        void bubb(employee emp,int n);       //bubble sort

        {
            employee temp;
            for(int j = 0;j  < n; j++)
            {
                if(emp[j].salary<emp[j+1].salary)
                {
                    for(int i = j; i < n-1; i++)
                    {
                        temp=emp[i];
                        emp[i]=emp[i+1];
                        emp[i+1]=temp;
                    }
                }
            }

        	std::cout << "Employee entered information:"<< std::endl;
        	std::cout << "============================" << std::endl;
        	std::cout << "Name  salary birthday   Sex	" << std::endl;

            for(i = 0; i < n; i++)
            {
                	std::cout << emp[i].name		<< "\t";
            		std::cout << emp[i].salary << "\t";
            		std::cout << emp[i].birthday; std::cout	<< "\t";
            		std::cout << emp[i].sex    ;
            		std::cout << std::endl;
            
            }

            int highest_salary=0; 
            int total_salary=0; 
            for(i = 0; i < n; i++)
            {
                if(emp[i].salary > highest_salary)
                {
                    highest_salary = emp[i].salary;
                }
                total_salary += emp[i].salary;
            }
            std::cout<<std::endl;
            std::cout << "Total Salary: "   << total_salary <<std::endl;
            std::cout << "============"<<std::endl;
            std::cout << "Highest Salary: " << highest_salary << std::endl;
            std::cout << "=============="<<std::endl;

            //void main();      //calc tax
    
            float tax=0;      
            float salary=0;
    
            if(emp[i].salary <= 1999)
            {
                tax = (emp[i].salary*5)/100;
            }
            else if (emp[i].salary<=2999)
            {
                tax=(emp[i].salary*7.5)/100;
    	    }
    
            else if (emp[i].salary<=3999)
    	    {
                tax=(emp[i].salary*10)/100;
    	    }
            else  if (emp[i].salary>4000)
    	    {
                tax=(emp[i].salary*15)/100;
    	    }

            salary=emp[i].salary-tax;

            std::cout<<"Salary after tax :"<<"  Employee Name :   "<<std::endl;
            std::cout<<"================ " <<"   ============="<<std::endl;
            for(i = 0; i < n; i++)
            std::cout << salary <<"                   "  <<  emp[i].name << std::endl;                    
        }
    }
}