Sep 27, 2012 at 7:26pm UTC
My program has been tested for errors and now that all of them are fixed, I am not getting any output that's been cout; the program doesn't run. I'm running a Windows 7 Alienware. After typing "g++ -Wall -o lab4.exe lab4.cpp" I no longer receive errors, but my program does absolutely nothing.
My code:
#include <iostream>
int main() {
std::cout << "Enter Tax Filing Categories" << std::endl;
std::cout << "1) Single" << std::endl;
std::cout << "2) Married Filing Jointly" << std::endl;
int category;
unsigned int income;
int tax;
std::cout << "Enter Tax Filing Category: " << category;
std::cin >> category;
std::cin.ignore(80, '\n');
char name[80];
std::cout << "Enter First and Last Name: " << name;
std::cin >> name;
std::cin.getline( name,80 );
std::cout << "Enter 2011 Taxable Income: " << income;
std::cin >> income;
if (category == 1) {
if(income <= 10001){
tax = (income * 0.1);
}
else if(income <= 40001){
tax = (income * 0.15);
}
else if(income < 60001) {
tax = (income * 0.20);
}
else
tax =(income * 0.25);
}
else if (category==2){
if (income <= 20001){
tax = (income * .10);
}
else if (income <= 60001){
tax = (income * 0.15);
}
else if(income < 150001){
tax = (income * 0.20);
}
else
tax = (income * 0.25);
}
else {
std::cout << "Invalid Filing Category" << std::endl;
return(0);
}
int incometax = (tax + income);
std::cout << name << "Your 2011 income tax is " << incometax << " dollars." << std::endl;
return (0);
}
Last edited on Sep 27, 2012 at 7:31pm UTC