uninitialized local variable - help?

I'm very new at C++ and I feel a bit (a LOT) out of my depth. I'm sure my problem is very obvious, but I just can't figure it out. One minute my code was working find and the next it just... wasn't. I can't remember what, if anything, I changed. Is this my program or simply the application being a pain?

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
#include <iostream>                                      //Preprocessor directive for cout
using namespace std;

int main() 
{ 
	double cost, state, county, sTax, cTax, tTax, tCost; //Identifiers for tax rates, cost, and total price. 

	sTax = cost * state;
	cTax = cost * county;
	tTax = sTax + cTax;
	tCost = cost + tTax;

	cout << "This program finds the cost of taxes on an item and the total cost of the item."; 

	cout << "\n\nWhat is the state tax rate as a decimal value?"; 
	cin >> state;
	cout << "\nWhat is the county tax as a decimal value?"; 
	cin >> county;
	cout << "\nWhat is the cost of the item?"; 
	cin >> cost;

	cout << "\n\nFor a $" << cost << "item, the tax is $" << sTax << ",\n"; 
	cout << "the county tax is $" << cTax;
	cout << ", the total tax on the item is $" << tTax << ".\n\n"; 

	cout << "The total cost of the item is $" << tCost << ".\n\n"; 

	cout << "Programmer: name here"; 

}


Every time I go to compile it I get "uninitialized local variable" on "state, cost, and county" on lines 8 and 9, and when I run it it errors immediately. Please tell me this is something stupid and obvious?
Last edited on
Aaand, I figured it out. It turns out I'm just clueless and mixed up the order it needed to be in. Thanks anyway, guys. I'll more than likely be back *g*
Topic archived. No new replies allowed.