-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinalipl2.cpp
957 lines (957 loc) · 35.3 KB
/
finalipl2.cpp
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
class half;
class winprediction;
class player
{
int ball, baavg, bwick, bwavg, btwavg;
friend class winprediction;
friend class wicketprediction;
friend class prediction;
public:
void wickets()
{
cout << "Enter the number of wickets fallen in 6 overs ";
cin >> ball;
cout << "Enter number of average wickets fallen in previous matches by the team ";
cin >> baavg;
cout << "Enter the wickets taken in most mathes in first 6 overs ";
cin >> bwick;
cout << "Enter the wickets taken in most matches ";
cin >> bwavg;
cout << "Enter the wickets takem by most of the teams ";
cin >> btwavg;
}
};
class teamhistroy
{
double runrate, avgrr;
int avg1, avg2;
friend class winprediction;
friend class wicketprediction;
friend class prediction;
public:
void condition()
{
cout << "Enter the average runs scored by most teams in current pitch ";
cin >> avg1;
cout << "Enter the average runs scored by team in previous matches ";
cin >> avg2;
cout << "Enter the runrate at 6 overs ";
cin >> runrate;
cout << "Enter average runrate in previous matches of team ";
cin >> avgrr;
}
};
class over
{
int o, n4, n5;
double o1;
friend class winprediction;
friend class wicketprediction;
friend class prediction;
friend class half;
friend class team;
public:
void runs()
{
cout << "Enter runs scored by first 6 overs ";
cin >> o;
cout << "Enter the matches played in current year by batting team ";
cin >> n4;
cout << "Enter the natches played in current year by balling team ";
cin >> n5;
if (n4 != 0)
{
cout << "Enter the average runs scored by team in first 6 overs in previous matches ";
cin >> o1;
}
}
};
class team
{
string t, t1, tw;
int n, n1, win, win1, loss, sc, n3, i, tp, p1, p2, rr, rr1;
over f;
// team s;
double avg;
friend class winprediction;
friend class wicketprediction;
friend class prediction;
friend class half;
public:
void teamname()
{
// s.code();
cout << "Enter the name of batting team ";
cin >> t;
cout << "Enter the name of balling team ";
cin >> t1;
}
void position()
{
if ((f.n4 >= 3 && f.n5 >= 3) || (f.n4 >= 2 && f.n5 >= 3) || (f.n4 >= 3 && f.n5 >= 2))
{
cout << "Enter the position of team " << t << "in points table ";
cin >> p1;
cout << "Enter the position of team " << t1 << "in points table ";
cin >> p2;
cout << "Enter the net runrate on points table of team " << t;
cin >> rr;
cout << "Enter the net runrate on points table of team " << t1;
cin >> rr1;
}
}
void wincriteria()
{
cout << "total number of matches did batting team played ";
cin >> n;
cout << "total number of matches did balling team played ";
cin >> n1;
cout << "Enter the name of toss winning team ";
cin >> tw;
cout << "Enter the number of matches played by teams against each other ";
cin >> tp;
}
void performance()
{
int a[n3];
cout << "Enter number of matches played against each other previously ";
cin >> n3;
if (n3 > 0)
{
for (i = 0; i < n3; i++)
{
cin >> a[i];
}
for (i = 0; i < n3; i++)
{
avg = a[i];
}
}
else
{
cout << "No matches played previously " << endl;
}
}
};
// class teamcode
//{
// public:
// int code()
// {
// cout<<"code '1', team is 'GT'"<<endl;
// cout<<"code '2', team is 'CSK'"<<endl;
// cout<<"code '3', team is 'LSG'"<<endl;
// cout<<"code '4', team is 'DC'"<<endl;
// cout<<"code '5', team is 'RR'"<<endl;
// cout<<"code '6', team is 'SRH'"<<endl;
// cout<<"code '7', team is 'MI'"<<endl;
// cout<<"code '8', team is 'RCB'"<<endl;
// }
// };
class prediction
{
int i, cnt = 0;
public:
void predicts(player a, teamhistroy t, over o);
};
//member of class prediction.
void prediction::predicts(player a, teamhistroy t, over o)
{
{
cout << "Predicted score according to runrate " << (t.runrate * 20) << endl;
while (cnt <= 3)
{
static int i = t.runrate; // check that static doen't take value zero
cout << "Score if runrate is " << i << " = " << (i * 20) << endl;
i++;
cnt++;
}
if (o.n4 >= 3)
{
if (t.avg2 >= 171)
{
if (a.ball >= 4)
{
cout << "Predicted score by wickets is " << (t.avg2 - 10) << endl;
}
else if (a.ball == 2)
{
cout << "Predicted score by wickets is " << (t.avg2 + 13) << endl;
}
else if (a.ball == 3)
{
cout << "Predicted score by wickets is " << t.avg2 << endl;
}
else if (a.ball <= 1)
{
cout << "Predicted score by wickets is " << (t.avg2 + 24) << endl;
}
}
else
{
if (a.ball >= 4){
cout << "Predicted score by wickets is " << (t.avg2 - 19) << endl;
}
else if (a.ball == 3){
cout << "Predicted score by wickets is " << t.avg2 << endl;
}
else if (a.ball == 2){
cout << "Predicted score by wickets is " << (t.avg2 + 6) << endl;
}
else if (a.ball == 1){
cout << "Predicted score by wickets is " << (t.avg2 + 15) << endl;
}
else{
cout << "Predicted score by wickets is " << (t.avg2 + 23) << endl;
}
}
}
else if (o.n4 >= 0 || o.n4 <= 2)
{
if (a.ball >= 4)
{
cout << "Predicted score by wickets is " << (t.avg1 - 15) << endl;
}
else if (a.ball == 3)
{
cout << "Predicted score by wickets is " << t.avg1 << endl;
}
else if (a.ball == 2)
{
cout << "Predicted score by wickets is " << (t.avg1 + 9) << endl;
}
else if (a.ball == 1)
{
cout << "Predicted score by wickets is " << (t.avg1 + 18) << endl;
}
else
{
cout << "Predicted score by wickets is " << (t.avg1 + 26) << endl;
}
}
}
}
class wicketprediction
{
public:
void wicketpredicts(player a, over o);
};
// member of class wicket prediction.
void wicketprediction::wicketpredicts(player a, over o)
{
if (o.n4 >= 3)
{
if (a.bwavg >= 6)
{
if (a.ball >= 4)
{
cout << "predicted wickets will be 10" << endl;
}
else if (a.ball == 3)
{
cout << "predicted wickets will 8 " << endl;
}
else if (a.ball == 2)
{
cout << "predicted wickets will be " << a.bwavg << endl;
}
else if (a.ball <= 1)
{
cout << "preidcted wickets will be " << (a.bwavg - 2) << endl;
}
}
else
{
if (a.ball >= 4)
{
cout << "predicted wickets will be 10" << endl;
}
else if (a.ball == 3)
{
cout << "predicted wickets will 7 " << endl;
}
else if (a.ball == 2)
{
cout << "predicted wickets will be " << a.bwavg << endl;
}
else if (a.ball <= 1)
{
cout << "preidcted wickets will be " << (a.bwavg - 1) << endl;
}
}
}
else if (o.n4 >= 0 || o.n4 <= 2)
{
if (a.ball >= 4)
{
cout << "predicted wickets will be 10" << endl;
}
else if (a.ball == 3)
{
cout << "predicted wickets will 8 " << endl;
}
else if (a.ball == 2)
{
cout << "predicted wickets will be " << a.btwavg << endl;
}
else if (a.ball <= 1)
{
cout << "preidcted wickets will be " << (a.btwavg - 2) << endl;
}
}
}
class half
{
int i,c;
public:
void halfpredict(over s, team n);
};
//member of class half.
void half ::halfpredict(over s, team n)
{
cout<< "Enter the number of matches played by team against each other ";
cin>>i;
if (i != 0)
{
if (i >= 2)
{
cout << "Enter the '1' if toss winning team won most times ";
cout << "Enter the '2' if toss lossing team won most times ";
cout << "Enter the '3' if both team won equally ";
cin >> c;
}
}
if ((s.n4 >= 3 && s.n5 >= 3) || (s.n4 >= 2 && s.n5 >= 3) || (s.n4 >= 3 && s.n5 >= 2))
{
if (i >= 2 && c == 1)
{
cout << "Winning percentage of team " << n.t << "is 85%";
cout << "Winning percentage of team " << n.t1 << "is 15% ";
}
else if (i >= 2 && c == 2)
{
cout << "Winning percentage of team " << n.t << "is 15% ";
cout << "Winning percentage of team " << n.t1 << "is 85% ";
}
else if (i >= 2 && c == 3)
{
if (n.rr > n.rr1)
{
cout << "Winning percentage of team " << n.t << "is 55% ";
cout << "Winning percentage of team " << n.t1 << "is 45% ";
}
else if (n.rr < n.rr1)
{
cout << "Winning percentage of team " << n.t << "is 45% ";
cout << "Winning percentage of team " << n.t1 << "is 55% ";
}
else if (n.rr == n.rr1)
{
if (n.p2 + 1 == n.p1 || n.p2 == n.p1 + 1)
{
if (!n.t.compare(n.tw))
{
cout << "Winning percentage of team " << n.t << "is 55% ";
cout << "Winning percentage of team " << n.t1 << "is 45% ";
}
else if (!n.t1.compare(n.tw))
{
cout << "Winning percentage of team " << n.t << "is 45% ";
cout << "Winning percentage of team " << n.t1 << "is 55% ";
}
}
else if (n.p1 + 2 >= n.p2)
{
cout << "Winning percentage of team " << n.t << "is 58% ";
cout << "Winning percentage of team " << n.t1 << "is 42% ";
}
else if (n.p1 <= n.p2 + 2)
{
cout << "Winning percentage of team " << n.t << "is 42% ";
cout << "Winning percentage of team " << n.t1 << "is 58% ";
}
}
}
else if (i < 2)
{
if (n.p2 + 1 == n.p1 || n.p2 == n.p1 + 1)
{
if (!n.t.compare(n.tw))
{
cout << "Winning percentage of team " << n.t << "is 55% ";
cout << "Winning percentage of team " << n.t1 << "is 45% ";
}
else if (!n.t1.compare(n.tw))
{
cout << "Winning percentage of team " << n.t << "is 45% ";
cout << "Winning percentage of team " << n.t1 << "is 55% ";
}
}
else if (n.p1 + 2 >= n.p2)
{
cout << "Winning percentage of team " << n.t << "is 58% ";
cout << "Winning percentage of team " << n.t1 << "is 42% ";
}
else if (n.p1 <= n.p2 + 2)
{
cout << "Winning percentage of team " << n.t << "is 42% ";
cout << "Winning percentage of team " << n.t1 << "is 58% ";
}
}
}
else
{
if (!n.t.compare(n.tw))
{
cout << "Winning percentage of team " << n.t << "is 55% ";
cout << "Winning percentage of team " << n.t1 << "is 45% ";
}
else if (!n.t1.compare(n.tw))
{
cout << "Winning percentage of team " << n.t << "is 45% ";
cout << "Winning percentage of team " << n.t1 << "is 55% ";
}
}
}
class winprediction
{
int w1, w2, win1, win2, r, r1, wr;
friend class half;
public:
void winpredicts(team x, over s, player y, half m);
};
//member of class winprediction
void winprediction ::winpredicts(team x, over s, player y, half m)
{
// cout<<"If the team win the toss there is 40% more chances that the team will win";
cout << "Enter the winning percentage in current year of team " << x.t << "in total matches played previous this year";
cin >> w1;
cout << "Enter the winning percentage in current year of team " << x.t1 << "in total matches played previous this year";
cin >> w2;
cout << "Enter the runs scored by the first batting team in first 6 overs ";
cin >> r;
cout << "Enter the wickets fallen by the first batting team in first 6 overs ";
cin >> wr;
cout << "Enter the runs scored by the batting team in 20 overs ";
cin >> r1;
/* ********* MAIN PREDICTIION *********** */
if (r1 > 205 && ((r - s.o) <= -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 92% ";
cout << "Winning percentage of team " << x.t1 << "is 8% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 82% ";
cout << "Winning percentage of team " << x.t1 << "is 18% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 97% ";
cout << "Winning percentage of team " << x.t1 << "is 3% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 78% ";
cout << "Winning percentage of team " << x.t1 << "is 22% ";
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 80% ";
cout << "Winning percentage of team " << x.t1 << "is 20% ";
}
}
else if ((r1 > 205) && ((r - s.o) >= 11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 92% ";
cout << "Winning percentage of team " << x.t1 << "is 8% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 89% ";
cout << "Winning percentage of team " << x.t1 << "is 11% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 99% ";
cout << "Winning percentage of team " << x.t1 << "is 1% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 79% ";
cout << "Winning percentage of team " << x.t1 << "is 21% ";
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 87% ";
cout << "Winning percentage of team " << x.t1 << "is 13% ";
}
}
else if ((r1 <= 205 && r1 > 185) && ((r - s.o) <= -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 90% ";
cout << "Winning percentage of team " << x.t1 << "is 10% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 83% ";
cout << "Winning percentage of team " << x.t1 << "is 17% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 95% ";
cout << "Winning percentage of team " << x.t1 << "is 5% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 69% ";
cout << "Winning percentage of team " << x.t1 << "is 31% ";
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 85% ";
cout << "Winning percentage of team " << x.t1 << "is 15% ";
}
}
else if ((r1 <= 205 && r1 > 185) && ((r - s.o) >= 11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 90% ";
cout << "Winning percentage of team " << x.t1 << "is 10% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 82% ";
cout << "Winning percentage of team " << x.t1 << "is 18% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 96% ";
cout << "Winning percentage of team " << x.t1 << "is 4% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 81% ";
cout << "Winning percentage of team " << x.t1 << "is 19% ";
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 85% ";
cout << "Winning percentage of team " << x.t1 << "is 15% ";
}
}
else if ((r1 <= 185 && r1 >= 169) && ((r - s.o) <= -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 62% ";
cout << "Winning percentage of team " << x.t1 << "is 37% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 55% ";
cout << "Winning percentage of team " << x.t1 << "is 45% ";
// by points rtable or by toss win prpbability ;
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 69% ";
cout << "Winning percentage of team " << x.t1 << "is 31% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 47% ";
cout << "Winning percentage of team " << x.t1 << "is 53% ";
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
else if ((r1 <= 185 && r1 >= 169) && ((r - s.o) >= 11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 65% ";
cout << "Winning percentage of team " << x.t1 << "is 35% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 55% ";
cout << "Winning percentage of team " << x.t1 << "is45% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 70% ";
cout << "Winning percentage of team " << x.t1 << "is 30% ";
}
else if ((wr - y.ball) > 2)
{
m.halfpredict(s,x);
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 60% ";
cout << "Winning percentage of team " << x.t1 << "is 40% ";
// check by toss and points table.
}
}
else if ((r1 <= 168 && r1 >= 150) && ((r - s.o) <= -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 45% ";
cout << "Winning percentage of team " << x.t1 << "is 55% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 40% ";
cout << "Winning percentage of team " << x.t1 << "is 60% ";
}
else if ((wr - y.ball) < -2)
{
m.halfpredict(s,x);
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 30% ";
cout << "Winning percentage of team " << x.t1 << "is 70% ";
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
else if ((r1 < 149) && ((r - s.o) >= 11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 40% ";
cout << "Winning percentage of team " << x.t1 << "is 60% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 31% ";
cout << "Winning percentage of team " << x.t1 << "is 69% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 45% ";
cout << "Winning percentage of team " << x.t1 << "is 55% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 25% ";
cout << "Winning percentage of team " << x.t1 << "is 75% ";
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 25% ";
cout << "Winning percentage of team " << x.t1 << "is 75% ";
}
}
else if ((r1 < 149) && ((r - s.o) <= -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 40% ";
cout << "Winning percentage of team " << x.t1 << "is 60% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 10% ";
cout << "Winning percentage of team " << x.t1 << "is 90% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 42% ";
cout << "Winning percentage of team " << x.t1 << "is 58% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 5% ";
cout << "Winning percentage of team " << x.t1 << "is 95% ";
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 20% ";
cout << "Winning percentage of team " << x.t1 << "is 80% ";
}
}
if (r1 > 205 && ((r - s.o) <= 0 && (r - s.o) > -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 97% ";
cout << "Winning percentage of team " << x.t1 << "is 3% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 87% ";
cout << "Winning percentage of team " << x.t1 << "is 13% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 99% ";
cout << "Winning percentage of team " << x.t1 << "is 1% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 85% ";
cout << "Winning percentage of team " << x.t1 << "is 15% ";
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 90% ";
cout << "Winning percentage of team " << x.t1 << "is 10% ";
}
}
else if (r1 > 205 && ((r - s.o) >= 0 && (r - s.o) < 11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 99% ";
cout << "Winning percentage of team " << x.t1 << "is 1% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 95% ";
cout << "Winning percentage of team " << x.t1 << "is 5% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 99% ";
cout << "Winning percentage of team " << x.t1 << "is 1% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 92% ";
cout << "Winning percentage of team " << x.t1 << "is 8% ";
}
else if ((wr - y.ball) == 0)
{
cout << "Winning percentage of team " << x.t << "is 88% ";
cout << "Winning percentage of team " << x.t1 << "is 12% ";
}
}
else if ((r1 <= 205 && r1 > 185) && ((r - s.o) <= 0 && (r - s.o) > -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 93% ";
cout << "Winning percentage of team " << x.t1 << "is 7% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 85% ";
cout << "Winning percentage of team " << x.t1 << "is 15% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 88% ";
cout << "Winning percentage of team " << x.t1 << "is 12% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 78% ";
cout << "Winning percentage of team " << x.t1 << "is 22% ";
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
else if ((r1 <= 205 && r1 > 185) && ((r - s.o) >= 0 && (r - s.o) < 11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 99% ";
cout << "Winning percentage of team " << x.t1 << "is 1% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 88% ";
cout << "Winning percentage of team " << x.t1 << "is 12% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 99% ";
cout << "Winning percentage of team " << x.t1 << "is 1% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 87% ";
cout << "Winning percentage of team " << x.t1 << "is 13% ";
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
else if ((r1 <= 185 && r1 >= 169) && ((r - s.o) <= 0 && (r - s.o) > -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 75% ";
cout << "Winning percentage of team " << x.t1 << "is 25% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 60% ";
cout << "Winning percentage of team " << x.t1 << "is 40% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 70% ";
cout << "Winning percentage of team " << x.t1 << "is 30% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 43% ";
cout << "Winning percentage of team " << x.t1 << "is 57% ";
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
else if ((r1 <= 185 && r1 >= 169) && ((r - s.o) >= 0 && (r - s.o) < 11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 79% ";
cout << "Winning percentage of team " << x.t1 << "is 21% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 64% ";
cout << "Winning percentage of team " << x.t1 << "is 36% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 80% ";
cout << "Winning percentage of team " << x.t1 << "is 20% ";
}
else if ((wr - y.ball) > 2)
{
m.halfpredict(s,x);
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
else if ((r1 <= 168 && r1 >= 150) && ((r - s.o) <= 0 && (r - s.o) > -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 45% ";
cout << "Winning percentage of team " << x.t1 << "is 55% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 40% ";
cout << "Winning percentage of team " << x.t1 << "is 60% ";
}
else if ((wr - y.ball) < -2)
{
m.halfpredict(s,x);
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 30% ";
cout << "Winning percentage of team " << x.t1 << "is 70% ";
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
else if ((r1 < 149) && ((r - s.o) >= 0 && (r - s.o) < 11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 40% ";
cout << "Winning percentage of team " << x.t1 << "is 60% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 31% ";
cout << "Winning percentage of team " << x.t1 << "is 69% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 45% ";
cout << "Winning percentage of team " << x.t1 << "is 55% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 25% ";
cout << "Winning percentage of team " << x.t1 << "is 75% ";
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
else if ((r1 < 149) && ((r - s.o) <= 0 && (r - s.o) > -11))
{
if ((wr - y.ball) <= -1 && (wr - y.ball) >= -2)
{
cout << "Winning percentage of team " << x.t << "is 43% ";
cout << "Winning percentage of team " << x.t1 << "is 58% ";
}
else if ((wr - y.ball) >= 1 && (wr - y.ball) <= 2)
{
cout << "Winning percentage of team " << x.t << "is 30% ";
cout << "Winning percentage of team " << x.t1 << "is 70% ";
}
else if ((wr - y.ball) < -2)
{
cout << "Winning percentage of team " << x.t << "is 42% ";
cout << "Winning percentage of team " << x.t1 << "is 58% ";
}
else if ((wr - y.ball) > 2)
{
cout << "Winning percentage of team " << x.t << "is 10% ";
cout << "Winning percentage of team " << x.t1 << "is 90% ";
}
else if ((wr - y.ball) == 0)
{
m.halfpredict(s,x);
}
}
}
int main()
{
char t;
player d;
teamhistroy b;
over y;
prediction c;
wicketprediction e;
winprediction f;
team j;
half h;
d.wickets();
b.condition();
c.predicts(d,b,y);
e.wicketpredicts(d,y);
cout<<"2nd team is batting ??";
cout<<"Enter 'Y' or 'y' if yes and 'N' or 'n' for no "<<endl;
cin>>t;
if(t=='Y' || t=='y')
f.winpredicts(j,y,d,h);
return 0;
}