C++ Calculation solution

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.

My code as follow:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "stdafx.h"
#include <iostream>
using namespace 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();
}
You've posted this before. http://www.cplusplus.com/forum/beginner/19217/#msg99589
Why are you creating a new thread?
Was just trying to get more replies. my bad. mod can delete thread if i have broken the rules.
I don't really understand you question. What is the output of your code now?

Also, why >1001 on line 33?
Topic archived. No new replies allowed.