hi, Was thinking whether will it be able to match employee salary + bonus = total ? Eg, i have 5 employees that has salary AND bonus more than 1000, the final output should be 'there are 5 employees that has salary AND bonus more than 1000' and 'there are 5 employees that has salary AND bonus less than 1000' ?
Appreciate if anyone could show me the codes on how it works as i am relatively new on C++. thanks.
#include "stdafx.h"
#include <iostream>
usingnamespace std;
int main()
{
char name [100];
cout<<"This is an Calculator to calculate number of Employees having total salary and bonus more than 1000" << endl;
cout<<"What is your name?" << endl;
cin.getline (name,100);
cout<<"Hello, " << name << "." << endl;
int Salary[10], Bonus[10], lCount=0, gCount=0, i=0, j=0;
cout<<"Please Enter Employees Salary (Max 10 Employees)" << endl;
for (i=0; i<10; i++)
{
cout<<"Enter Employee " << i+1 << " Salary : " ;
cin>>Salary[i];
cin.ignore();
}
for (j=0; j<10; j++)
{
cout<<"Enter Employee " << j+1 << " Bonus : ";
cin>>Bonus[j];
cin.ignore();
}
for (i=0; i < 10; ++i)
{
if (Salary[i]+Bonus[i]>1001)
{lCount++;}
else
{gCount++;}
}
cout<<"There are " << lCount << " Employees with Salary and Bonus more then 1000\n";
cout<<"There are " << gCount << " Employees with Salary and Bonus less then 1000\n";
cin.get();
}