trying to add a running sum into a program

but having trouble figuring out how to write it.
i'm trying to put the running sum in a loop (that's not a while loop) that creates an average pay
with the hours, hourly wage (anything over 40 hours as additional hours at * 1.5) and hours worked.
i'm just having issues working out a loop w/ the accumulator

so far the program is as followed

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
#include <iostream>
#include <iomanip>
using namespace std;

int main()

{
	int employees,
		hours;
	double hourlyWage;

	cout << setprecision(2) << fixed;

	cout << "How many employees do you have?" << endl;
	cin >> employees;

	while (employees < 1 || employees > 10)
	{
		cout << "Please enter a correct amount of employees 1-10" << endl;
		cin >> employees;
	}


	cout << "How many hours do you work?" << endl;
	cin >> hours;

	cout << "What is the hourly wage?" << endl;
	cin >> hourlyWage;
I'm thinking these should just be included in the running sum so that it'll ask all employees for that information one by one and take the total after?


return 0;
}
Last edited on
this is what i have so far but i want to input 2 sets of test data within the parameters

1
2
3
4
5
6
7
for ( int count = 1; count <= employees; count++)
	{
		 if (hours > 40)
			 hourlyWage = hourlyWage * 1.5;
		 else (hours <= 40)
			 hourlyWage = hourlyWage;
		 cout << "What is the hourlyWage of  
Last edited on
Topic archived. No new replies allowed.