Bank Charges Program

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
45
46
// Includes
#include "stdafx.h"
#include <iostream>
using namespace std;

// Main Function
int main()
{
	float perMONTH = 10;
	double first , second , third , fourth , totalfee;
	double fee1 = .10, fee2 = .08, fee3 = .06, fee4 = .04;
	int checks;

	cout << "This is a bank charge program.\n\n";

	cout << "Enter the amount of checks you wrote this month: ";
	cin >> checks;

	while (checks < 0)
	{
		cout << "\n\nChecks must be greater than 0.\n\n";
		cout << "Enter the amount of checks you wrote this month: ";
		cin >> checks;
	}

	if (checks <= 20)
		first = (checks * fee1);
	else if (checks >= 21 && checks <= 39)
		second = (checks * fee2) + first;
	else if (checks >= 40 && checks <= 59)
		third = (checks * fee3) + first + second;
	else 
		fourth = (checks * fee4) + first + second + third;

	totalfee = (perMONTH + first + second + third + fourth);

	cout << "\n\n";
	cout << "Your total fee is $" << totalfee << endl;

	cout << endl << "Press ENTER to exit..";
	cin.clear();
	cin.sync();
	cin.get();

	return 0;
}


can anyone tell me why im getting thee errors

uninitialized local variable first used on line 29
uninitialized local variable second used on line 31
uninitialized local variable third on used line 33
Last edited on
second = (checks * fee2) + first;

What is the value of first at this point?
Topic archived. No new replies allowed.