Win32 Console Application - Help With Math

Hello, I'm currently working on a NFL Game Predictor. I thought it was a pretty cool idea for a beginner.... Anyways, I'm kind of a noob and would really appreciate it if somebody can help me out with the math part of the code.

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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#define _WIN32_WINNT  0x0500
#include <windows.h>
#include <Wincon.h>
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{ 
    //Data Table
    int iTeam1apy;
    int iTeam2apy;
    int iTeam1ary;
    int iTeam2ary;
    int iTeam1aya;
    int iTeam2aya;
    double dTeam1as;
    double dTeam2as;
    double dTeam1ai;
    double dTeam2ai;
    int iTeam1lp;
    int iTeam2lp;
    int iTeam1wl;
    int iTeam2wl;
    double dTeam1line;
    double dTeam2line;
    double dTeam1 = 10.0; // Home Team Gets 10.0 Points Advantage
    double dTeam2;
    double dTeam1p;
    double dteam2p;
    double dTotal;
    
    //Full Screen Mode    
    HWND hWnd = GetConsoleWindow();
    ShowWindow(hWnd,SW_SHOWMAXIMIZED);
    
    //Title & Color
    system("title NFL Game Predictor BETA Handicapping Software");
    system("color E2");
    
    //Instructions
    cout << "Loading NFL Predictor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \n";
    system("PAUSE");
    system("cls");
    cout << "Instructions: \n \n";
    cout << "Enter all the data needed to predict the game. \n \n";
    cout << "Offensive- Average Passing Yards Per Game \n \n";
    cout << "Offensive- Average Rushing Yards Per Game \n \n";
    cout << "Defensive- Average Yards Against Per Game \n \n";
    cout << "Defensive- Average Sacks Per Game (If less than 1, devide the number of sacks by the number of games played)\n \n";
    cout << "Defensive- Average Interceptions Per Game (If less than 1, devide the number of interceptions by the number of games played)\n \n";
    cout << "Team- League Position \n \n";
    cout << "Team- Win/Lose Streak (Must be more than 3 games) \n \n";
    cout << "Sport Book- Enter the lines from your sports book \n \n";
    system("pause");
    system("cls");
    
    //The Home Team
    cout << "Please Enter The Data For The Home Team. \n";
    cout << "Home Team Average Passing Yards Per Game? \n";
    cin >> iTeam1apy;
    cout << "\n";
    cout << "Home Team Average Rushing Yards Per Game? \n";
    cin >> iTeam1ary;
    cout << "\n";
    cout << "Home Team Average Yards Against Per Game? \n";
    cin >> iTeam1aya;
    cout << "\n";
    cout << "Home Team Average Sacks Per Game? \n";
    cin >> dTeam1as;
    cout << "\n";
    cout << "Home Team Average Interceptions Per Game? \n";
    cin >> dTeam1ai;
    cout << "\n";
    cout << "Home Team League Position? \n";
    cin >> iTeam1lp;
    cout << "\n";
    cout << "Home Team Win/Lose Streak? (Must Be Greater Than 3) \n";
    cin >> iTeam1wl;
    cout << "\n";
    cout << "Home Team Sports Book Odds, Money Line? (E.g.: 1.85) \n";
    cin >> dTeam1line;
    cout << "\n";
    system("pause");
    system("cls");
    
    // The Away Team
    cout << "Please Enter The Data For The Away Team. \n";
    cout << "Away Team Average Passing Yards Per Game? \n";
    cin >> iTeam2apy;
    cout << "\n";
    cout << "Away Team Average Rushing Yards Per Game? \n";
    cin >> iTeam2ary;
    cout << "\n";
    cout << "Away Team Average Yards Against Per Game? \n";
    cin >> iTeam2aya;
    cout << "\n";
    cout << "Away Team Average Sacks Per Game? \n";
    cin >> dTeam2as;
    cout << "\n";
    cout << "Away Team Average Interceptions Per Game? \n";
    cin >> dTeam2ai;
    cout << "\n";
    cout << "Away Team League Position? \n";
    cin >> iTeam2lp;
    cout << "\n";
    cout << "Away Team Win/Lose Streak? (Must Be Greater Than 3) \n";
    cin >> iTeam2wl;
    cout << "\n";
    cout << "Away Team Sports Book Odds, Money Line? (E.g.: 1.85) \n";
    cin >> dTeam2line;
    cout << "\n";
    system("pause");
    system("cls");
    cout << "CALCULATING ODDS .....\n";
    system("pause");
    system("CLS");
    
    // The Math
    // Scoring System:
    // Average Passing Yards = +0.5 Points Per Yard
    // Average Passing Yards = +1.0 Points Per Yard
    // Average Yards Against = -1.5 Points per Yard
    // Average Sacks = +5.0 Points Per Sack
    // Average Interceptions = +5.0 Points Per Interception 
    // League Rank = (1) 50.0 Points; (2) 40.0 Points; (3) 30.0 Points; (4) 20.0 Points ...
    // Win / Lose Streak = (3) +/- 20.0 Points; (4) +/- 25.0 Points; (5) +/- 30.0 Points ...
    // 
    // Sport Book odds : If dTeam1line < dTeam2line then dTeam1 + 10.0 Points 
    //                   If dTeam2line < dTeam1line then dTeam1 - 10.0 Points
    //
    // Comparing The Teams: If dTeam1 > dTeam2 then dTeam1 Wins
    //                      If dTeam2 > dTeam1 then dTeam2 Wins
    //
    // Calculate % for each team: dTeam1 + dTeam2 = dTotal 
    //                           dTotal / dTeam1 = dTeam1p
    //                           dTotal / dTeam2 = dTeam2p
    //
    // Display Winning Team and Percentage.
 
    //The End       
    system("pause");
    return EXIT_SUCCESS;
}


PS: I don't know if this is making any sence to you gurus, I'm a noob.. :S

Thanks Very Much.
Kind Regards
- Mat P.
Last edited on
Okay well I was very impatient and tried making it my self. I almsot got it to work but, it's NOT working. Please Take a Look.

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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#define _WIN32_WINNT  0x0500
#include <windows.h>
#include <Wincon.h>
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{ 
    //Data Table
    int iTeam1apy;
    int iTeam2apy;
    int iTeam1ary;
    int iTeam2ary;
    int iTeam1aya;
    int iTeam2aya;
    double dTeam1as;
    double dTeam2as;
    double dTeam1ai;
    double dTeam2ai;
    int iTeam1lp;
    int iTeam2lp;
    int iTeam1wl;
    int iTeam2wl;
    double dTeam1line;
    double dTeam2line;
    double dTeam1 = 10.0; // Home Team Gets 10.0 Points Advantage
    double dTeam2;
    double dTeam1p;
    double dteam2p;
    double dTotal;
    double temp;
    double Dapy = 0.5;
    double Dary = 1.0;
    double Daya = -1.5;
    double Das = 5.0;
    double Dai = 5.0;

    
    //Full Screen Mode    
    HWND hWnd = GetConsoleWindow();
    ShowWindow(hWnd,SW_SHOWMAXIMIZED);
    
    //Title & Color
    system("title NFL Game Predictor BETA Handicapping Software");
    system("color E2");
    
    //Instructions
    cout << "Loading NFL Predictor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \n";
    system("PAUSE");
    system("cls");
    cout << "Instructions: \n \n";
    cout << "Enter all the data needed to predict the game. \n \n";
    cout << "Offensive- Average Passing Yards Per Game \n \n";
    cout << "Offensive- Average Rushing Yards Per Game \n \n";
    cout << "Defensive- Average Yards Against Per Game \n \n";
    cout << "Defensive- Average Sacks Per Game (If less than 1, devide the number of sacks by the number of games played)\n \n";
    cout << "Defensive- Average Interceptions Per Game (If less than 1, devide the number of interceptions by the number of games played)\n \n";
    cout << "Team- League Position \n \n";
    cout << "Team- Win/Lose Streak (Must be more than 3 games) \n \n";
    cout << "Sport Book- Enter the lines from your sports book \n \n";
    system("pause");
    system("cls");
    
    //The Home Team
    cout << "Please Enter The Data For The Home Team. \n";
    cout << "Home Team Average Passing Yards Per Game? \n";
    cin >> iTeam1apy;
    cout << "\n";
    cout << "Home Team Average Rushing Yards Per Game? \n";
    cin >> iTeam1ary;
    cout << "\n";
    cout << "Home Team Average Yards Against Per Game? \n";
    cin >> iTeam1aya;
    cout << "\n";
    cout << "Home Team Average Sacks Per Game? \n";
    cin >> dTeam1as;
    cout << "\n";
    cout << "Home Team Average Interceptions Per Game? \n";
    cin >> dTeam1ai;
    cout << "\n";
    cout << "Home Team League Position? \n";
    cin >> iTeam1lp;
    cout << "\n";
    cout << "Home Team Win/Lose Streak? (Must Be Greater Than 3) \n";
    cin >> iTeam1wl;
    cout << "\n";
    cout << "Home Team Sports Book Odds, Money Line? (E.g.: 1.85) \n";
    cin >> dTeam1line;
    cout << "\n";
    system("pause");
    system("cls");
    
    // The Away Team
    cout << "Please Enter The Data For The Away Team. \n";
    cout << "Away Team Average Passing Yards Per Game? \n";
    cin >> iTeam2apy;
    cout << "\n";
    cout << "Away Team Average Rushing Yards Per Game? \n";
    cin >> iTeam2ary;
    cout << "\n";
    cout << "Away Team Average Yards Against Per Game? \n";
    cin >> iTeam2aya;
    cout << "\n";
    cout << "Away Team Average Sacks Per Game? \n";
    cin >> dTeam2as;
    cout << "\n";
    cout << "Away Team Average Interceptions Per Game? \n";
    cin >> dTeam2ai;
    cout << "\n";
    cout << "Away Team League Position? \n";
    cin >> iTeam2lp;
    cout << "\n";
    cout << "Away Team Win/Lose Streak? (Must Be Greater Than 3) \n";
    cin >> iTeam2wl;
    cout << "\n";
    cout << "Away Team Sports Book Odds, Money Line? (E.g.: 1.85) \n";
    cin >> dTeam2line;
    cout << "\n";
    system("pause");
    system("cls");
    cout << "CALCULATING ODDS .....\n";
    system("pause");
    system("CLS");
    
    // The Math
    // Scoring System:
    // Average Passing Yards = +0.5 Points Per Yard
    // Average Passing Yards = +1.0 Points Per Yard
    // Average Yards Against = -1.5 Points per Yard
    // Average Sacks = +5.0 Points Per Sack
    // Average Interceptions = +5.0 Points Per Interception 
    // League Rank = (1) 50.0 Points; (2) 40.0 Points; (3) 30.0 Points; (4) 20.0 Points ...
    // Win / Lose Streak = (3) +/- 20.0 Points; (4) +/- 25.0 Points; (5) +/- 30.0 Points ...
    // 
    // Sport Book odds : If dTeam1line < dTeam2line then dTeam1 + 10.0 Points 
    //                   If dTeam2line < dTeam1line then dTeam1 - 10.0 Points
    //
    // Comparing The Teams: If dTeam1 > dTeam2 then dTeam1 Wins
    //                      If dTeam2 > dTeam1 then dTeam2 Wins
    //
    // Calculate % for each team: dTeam1 + dTeam2 = dTotal 
    //                           dTotal / dTeam1 = dTeam1p
    //                           dTotal / dTeam2 = dTeam2p
    //
    // Display Winning Team and Percantage.
    
    // Calculating Odds.
    // Team 1
    
    temp = iTeam1apy * Dapy;
    dTeam1 = temp + dTeam1;
    
    temp = iTeam1ary * Dary;
    dTeam1 = temp + dTeam1;
    
    temp = iTeam1aya * Daya;
    dTeam1 = temp + dTeam1;
    
    temp = dTeam1as * Das;
    dTeam1 = temp + dTeam1;
    
    temp = dTeam1ai * Dai;
    dTeam1 = temp + dTeam1;
    
    //Team 2
    
    temp = iTeam2apy * Dapy;
    dTeam2 = temp + dTeam2;
    
    temp = iTeam2ary * Dary;
    dTeam2 = temp + dTeam2;
    
    temp = iTeam2aya * Daya;
    dTeam2 = temp + dTeam2;
    
    temp = dTeam2as * Das;
    dTeam2 = temp + dTeam2;
    
    temp = dTeam2ai * Dai;
    dTeam2 = temp + dTeam2;  
    
    //If Statments
    //League Position
    //Team 1
     
    if (iTeam1lp == 1)
       dTeam1 = dTeam1 + 50;
       
    if (iTeam1lp == 2)
       dTeam1 = dTeam1 + 40;
       
    if (iTeam1lp == 3)
       dTeam1 = dTeam1 + 30;
       
    if (iTeam1lp == 4)
       dTeam1 = dTeam1 + 20;
    
    if (iTeam1lp == 5)
       dTeam1 = dTeam1 + 10;
       
    //Team 2
    
    if (iTeam2lp == 1)
       dTeam2 = dTeam2 + 50;
       
    if (iTeam2lp == 2)
       dTeam2 = dTeam2 + 40;
       
    if (iTeam2lp == 3)
       dTeam2 = dTeam2 + 30;
       
    if (iTeam2lp == 4)
       dTeam2 = dTeam2 + 20;
    
    if (iTeam2lp == 5)
       dTeam2 = dTeam2 + 10;   
       
    // Win/Lose Streak if statments
    // Team 1
    
    if (iTeam1wl == 3)
       dTeam1 = dTeam1 + 20;
       
    if (iTeam1wl == 4)
       dTeam1 = dTeam1 + 25;
       
    if (iTeam1wl >= 5)
       dTeam1 = dTeam1 + 30;
       
    if (iTeam1wl == -3)
       dTeam1 = dTeam1 - 20;
       
    if (iTeam1wl == -4)
       dTeam1 = dTeam1 - 25;
       
    if (iTeam1wl >= -5)
       dTeam1 = dTeam1 - 30;   

       //Team 2 If Statments
       
    if (iTeam2wl == 3)
       dTeam2 = dTeam2 + 20;
       
    if (iTeam2wl == 4)
       dTeam2 = dTeam2 + 25;
       
    if (iTeam2wl >= 5)
       dTeam2 = dTeam2 + 30;
       
    if (iTeam2wl == -3)
       dTeam2 = dTeam2 - 20;
       
    if (iTeam2wl == -4)
       dTeam2 = dTeam2 - 25;
       
    if (iTeam2wl >= -5)
       dTeam2 = dTeam2 - 30;   
       
    // Sport Book Lines. If statments
    if (dTeam1line > dTeam2line)
       dTeam1 = dTeam1 + 10;
       
    if (dTeam2line > dTeam1line)
       dTeam2 = dTeam2 + 10; 
       
    // Final 
    cout << "Generated Score: \n";
    cout << "Home Team: " << dTeam1 << "Away Team: " << dTeam2;
           
       
    
    system("pause");
 
    //The End    
      
    system("pause");
    return EXIT_SUCCESS;
}
I posted it here originally but nobody answered, figured it was the wrong forum. Sorry ...
Last edited on
Topic archived. No new replies allowed.