Adding while using for-loop

So I'm a first timer using this website, and first time using C++ or doing any programming. I am stuck with this assignment "Write a program that prompts the user for the number of tellers at Nation’s Bank in Hyatesville that worked each of the last three years. For each worker the program should ask for the number of days out sick for each of the last three years. The output should provide the number of tellers and the total number of days missed by all the tellers over the last three years."
I have been able to produce the code for everything, except being able to add up the totals for the different tellers, I am stuck and cant tell where the mistake is, I have tried multiple different ways but nothing seems to work.
Thanks for any help or input.

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
// Lab 5.6 Juan Maraboli generated code 
#include <iostream>
using namespace std;

int main()
{
	int numTellers, numDaysOff, total, totaldayOff;
	int teller, year = 0; // counters for the loops

	cout << "How many tellers worked at Nation's bank during each of the last three years?" << endl << endl;
	cin >> numTellers;

	for (teller = 1; teller <= numTellers; teller++)
	{
		total = 0;
		for (year = 1; year <= 3; year++)
		{
			cout << "How many days was teller " << teller << " out sick during year " << year << "." << endl;
			cin >> numDaysOff;			
		}
		total = total + numDaysOff;
	}
	total = (total + total);

	cout << endl;
	cout << "The " << numTellers << " tellers were out sick for a total of " << total << " days during the last 3 years." << endl << endl << endl;

	return 0;
}
Line 15 , Total becomes 0 every time you finish the inner for loop, so take it to line 12.
Similarly Line 21 should be inside the inner loop.
Then what is line 23 doing?

Try to understand the scope of the variables when using the loops.
Thank you
Topic archived. No new replies allowed.