Math not working properly

So I'm making a little program to help me calculate tax for math homework , but when i run the program the math is not working properly
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
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main (int nNumberofArgs, char* pszArgs[])
{
    int GI;         //Gross Income
    int SRCP;       //Standard Rate Cutoff Point
    int TALR;       //Tax at lower rate
    int TAHR;       //Tax at higher rate
    int GT;         //Gross Tax
    int NI;         //Net Income
    int TC;         //Tax Credits
    int NT;         //Net Tax
    int TAHRTBC;    //Tax At higher rate to be calculated
    int TALRTBC;    //Tax At lower rate to be calculated
    int CNT;


    cout << "Please enter the Gross Income: " << endl;
    cin >> GI;
    system ("PAUSE");
    cout << "Please now enter your Standard Rate Cutoff Point: " << endl;
    cin >> SRCP;
    system ("PAUSE");
    cout << "Please enter your Tax Credits: " << endl;
    cin >> TC;
    system ("PAUSE");

    cout << "Is this info correct? : " << "\n" << "Gross Income: " << GI << " SRCP: " << SRCP << " Tax Credits: " << TC << " Press 1 for yes 2 for no \n  ";
    cin >> CNT;

    if (CNT == 1)
{





    GI - SRCP == TAHRTBC;
    SRCP == TALRTBC;

    TALRTBC * 0.20 == TALR;
    TAHRTBC * 0.41 == TAHR;
    TAHR + TALR == GT;
    GT - TC == NT;
    GI - NT == NI;

    cout << "############INFO GENERATED BY IRISH TAX CALCULATOR By Adrian Maciaszek############### \n Tax at Higher Rate: " << TAHR << "\n Tax at Lower Rate: " << TALR << "\n Gross Tax: " << GT << "\n Net Tax: " << NT << "\n Net Income: " << NI <<"\n ###################END OF FILE############# \n ";

}
    else
    {
        cout << "Re-enter feature not working yet please restart program to re \n enter the info";
    }
}

The bit of code that gives me trouble
1
2
3
4
5
6
7
8
GI - SRCP == TAHRTBC;
    SRCP == TALRTBC;

    TALRTBC * 0.20 == TALR;
    TAHRTBC * 0.41 == TAHR;
    TAHR + TALR == GT;
    GT - TC == NT;
    GI - NT == NI;


When i run the program ( I run on mac so ignore the system pause errors)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Last login: Sat Jan 14 00:45:04 on ttys000
Adrians-MacBook-Pro:~ Adrian$ /Users/Adrian/Documents/C++/ITC/bin/Debug/ITC 
Please enter the Gross Income: 
80000
sh: PAUSE: command not found
Please now enter your Standard Rate Cutoff Point: 
40000
sh: PAUSE: command not found
Please enter your Tax Credits: 
2000
sh: PAUSE: command not found
Is this info correct? : 
Gross Income: 80000 SRCP: 40000 Tax Credits: 2000 Press 1 for yes 2 for no 
  1
############INFO GENERATED BY IRISH TAX CALCULATOR By Adrian Maciaszek############### 
 Tax at Higher Rate: 0
 Tax at Lower Rate: 0
 Gross Tax: 1513856963
 Net Tax: 1851042808
 Net Income: -382028345
 ###################END OF FILE############# 
 Adrians-MacBook-Pro:~ Adrian$ 


Tax at higher and lower rate should be zero what is the problem and how can i fix it
You should learn the difference between == and =. == checks for equality and returns a bool (true or false). = assigns a new value to a variable.

system ("PAUSE"); isn't working because there is no PAUSE command on mac. Do you really need it?
Im writing on mac but i will be running in mostly on windows thats why the command is there and thanks stupid mistake :) but now i get errors on the math lines
1
2
3
4
5
6
7
8
9
10
/Users/Adrian/Documents/C++/ITC/main.cpp||In function 'int main(int, char**)':|
/Users/Adrian/Documents/C++/ITC/main.cpp|42|error: lvalue required as left operand of assignment|
/Users/Adrian/Documents/C++/ITC/main.cpp|43|warning: statement has no effect|
/Users/Adrian/Documents/C++/ITC/main.cpp|45|error: lvalue required as left operand of assignment|
/Users/Adrian/Documents/C++/ITC/main.cpp|46|error: lvalue required as left operand of assignment|
/Users/Adrian/Documents/C++/ITC/main.cpp|47|error: lvalue required as left operand of assignment|
/Users/Adrian/Documents/C++/ITC/main.cpp|48|error: lvalue required as left operand of assignment|
/Users/Adrian/Documents/C++/ITC/main.cpp|49|error: lvalue required as left operand of assignment|
||=== Build finished: 6 errors, 1 warnings ===|
 
Last edited on
Topic archived. No new replies allowed.