Having trouble with calculations

Hi guys, so I have a pretty simple task here...I feel that I am close, but no cigar. I am basically trying to convert this calculator from excel to c++ code and have a simple output of the Total Commissions to the console. It's not some much that I don't understand the code, its more the math...I think.

So here is my code for the Calculations...

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
  #include <iostream>

using namespace std;

int main()
{
    double n1,n2,n3,n4,n5,grandTotal,subTotComm,subBrkrOffTopCut,subCommAftBrkrCut,finalTotComm;
    

        cout << "Enter Total Real Estate Price " << endl;
        cin >> n1;
        cout << "Enter your commision percent " << endl;
        cin >> n2;
        cout << "Enter Broker cut percent " << endl;
        cin >> n3;
        cout << "Enter Broke/Agent Split percent " << endl;
        cin >> n4;
        cout << "Enter Partner split percent" << endl;
        cin >> n5;

            n2/=100;
            n3/=100;
            n4/=100;
            n5/=100;

            subTotComm = n1*n2; //D4*D5

            subBrkrOffTopCut = subTotComm*n3;//D6*D7

            subCommAftBrkrCut = subTotComm - n3;//D6-D8

            finalTotComm = subCommAftBrkrCut*n4 ; //D9*D10

            grandTotal = finalTotComm* n5;//D11*D12

            cout << "You total commisions are $" << grandTotal << endl;
   
   return 0;
}


Here is a link to a pic of the excel doc I am working with.

http://i142.photobucket.com/albums/r102/axisdrummer89/1.png

What cells are being calculated together are noted in column F

The excel doc is outputting $4,692.00
My code is outputting $5,099.93

Any help would be appreciated.
The question is: what is the right result? If your formulas are correct the result is correct.

There might be a problem with precision on the excel side or a problem with the formulas on your program side.
I know for a fact that the excel document is 100% correct. I just cant translate the math into C++ :/ I been messing with it for hours and can't get the same results. I must not be understanding percentages right...and percentages is where the problems lies, im almost certain. Thanks for the response..if anyone has an idea let me know.
Topic archived. No new replies allowed.