Hello fellow programmers
I was recently trying to make a salary program for work...
the employee is paid $16.78/hour. and overtime after40hrs of $16.78/2 per hour after that.. there is 6% ssecurity tax, 14% for federal income tax, 5% for state income tax, and $10 per week for union dues. also if there are more than 3 dependents: additional $35 for health insurance. need to output gross pay, each withholding amount, and net pay for the week.
I think its right, but when i debug it, it says that "Run-Time Check Failure #3 - The variable 'hours' is being used without being initialized." and also Run-Time Check Failure #3 - The variable 'dependents' is being used without being initialized." window pops up. I thought that I did initialize it, but apparently not. im using VS 2008. also any pointers on how to make program better.

Thank you

my code:
Code:
#include<iostream>
#include<string>
using namespace std;

int main(){


int rate,hours,overtime,overtimerate,undues,overtimehours;
int dependents,dependnum,netpay,grosspay,sstaxt,fitaxt,sitaxt;		//initializes all the variables
string dependanswer;

overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
grosspay=rate*hours;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;


cout<<"How many hours were worked? \n";		//asks how many hours worked
cin>>hours;

cout<<"Do you have any dependents? <Y or N>? \n"; //do yo have dependents
cin>>dependanswer;	

if(hours>=41 && dependanswer=="y" || dependanswer=="Y" ){		//if you worked overtime and have dependents
	
	cout<<"How many dependents do you have? \n";
	cin>>dependnum;

if(dependnum>=3){		//if you have 3 or more dependents
		
		overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
grosspay=rate*hours;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
		grosspay=hours*rate+overtime;
		netpay=grosspay-sstaxt-fitaxt-sitaxt-undues-dependents;

		cout<<"Gross Pay: $"<<grosspay<<" \n";
		cout<<"Overtime hours: "<<overtimehours<<" \n";
		cout<<"Social Security: $"<<sstaxt<<" \n";
		cout<<"Federal Income: $"<<fitaxt<<" \n";
		cout<<"State Income: $"<<sstaxt<<" \n";
		cout<<"Union Dues: $10 \n";
		cout<<"Health Insurance: $"<<dependents<<" \n";
		cout<<"Net Pay: $"<<netpay<<" \n";
}

if(dependnum<=2){		//if you have less than 3 dependents

	overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
grosspay=rate*hours;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
		grosspay=hours*rate+overtime;
		netpay=grosspay-sstaxt-fitaxt-sitaxt-undues;
	cout<<"Gross Pay: $"<<grosspay<<" \n";
	cout<<"Overtime hours: "<<overtimehours<<" \n";
	cout<<"Social Security: $"<<sstaxt<<" \n";
	cout<<"Federal Income: $"<<fitaxt<<" \n";
	cout<<"State Income: $"<<sstaxt<<" \n";
	cout<<"Union Dues: $10 \n";
	cout<<"Health Insurance: $0 \n";
	cout<<"Net Pay: $"<<netpay<<" \n";
}
	
}
	
	
if(hours>=41 && dependanswer=="n" ||dependanswer=="N"){		//if overtime & you dont have dependents

	overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
grosspay=rate*hours;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
grosspay=hours*rate+overtime;
netpay=grosspay-sstaxt-fitaxt-sitaxt-undues;

cout<<"Gross Pay: $"<<grosspay<<" \n";
cout<<"Overtime hours: "<<overtimehours<<" \n";
cout<<"Social Security: $"<<sstaxt<<" \n";
cout<<"Federal Income: $"<<fitaxt<<" \n";
cout<<"State Income: $"<<sstaxt<<" \n";
cout<<"Union Dues: $10 \n";
cout<<"Health Insurance: $"<<dependents<<" \n";
cout<<"Net Pay: $"<<netpay<<" \n";

	}

if(hours<=40 && dependanswer=="y" || dependanswer=="Y"){		//if no overtime and dependents

	cout<<"How many dependents do you have? \n";
	cin>>dependnum;

if(dependnum>=3){		//if you have 3 or more dependents

	overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
grosspay=rate*hours;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
		netpay=grosspay-sstaxt-fitaxt-sitaxt-undues-dependents;

		cout<<"Gross Pay: $"<<grosspay<<" \n";
		cout<<"Overtime hours: 0 \n";
		cout<<"Social Security: $"<<sstaxt<<" \n";
		cout<<"Federal Income: $"<<fitaxt<<" \n";
		cout<<"State Income: $"<<sstaxt<<" \n";
		cout<<"Union Dues: $10 \n";
		cout<<"Health Insurance: $"<<dependents<<" \n";
		cout<<"Net Pay: $"<<netpay<<" \n";
}

if(dependnum<=2){		//if you have less than 3 dependents

	overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
grosspay=rate*hours;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
		netpay=grosspay-sstaxt-fitaxt-sitaxt-undues;
	cout<<"Gross Pay: $"<<grosspay<<" \n";
	cout<<"Overtime hours: 0 \n";
	cout<<"Social Security: $"<<sstaxt<<" \n";
	cout<<"Federal Income: $"<<fitaxt<<" \n";
	cout<<"State Income: $"<<sstaxt<<" \n";
	cout<<"Union Dues: $10 \n";
	cout<<"Health Insurance: $"<<dependents<<" \n";
	cout<<"Net Pay: $"<<netpay<<" \n";
}
	
}




	system("pause");
	return 0;
}