writing if else code

Oct 2, 2011 at 5:13pm
I am trying to write the following code in Visual C++. Could someone check and see what I am typing in wrong?

#include <iostream>
using namespace std;

int main()
{
if (income <= 10000)
tax = income * 0.1;
else if (income <= 20000)
tax = 1000 +
(income - 10000) * 0.15;

return 0;
}

Thanks for your help!
L
Oct 2, 2011 at 5:15pm
You never declare any of your variables. The compiler doesn't know what 'income' or 'tax' are.

You also never get those values from anywhere. How is the computer supposed to know how much income there is? You never tell it.
Oct 2, 2011 at 5:19pm
Thanks Disch
Oct 2, 2011 at 7:03pm
Tip: post the compiler error's message.
Topic archived. No new replies allowed.