YOU HAVE TO SOLVE THIS QUESTION USING C++

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

YOU HAVE TO SOLVE THIS QUESTION USING C++

Post by answerhappygod »

YOU HAVE TO SOLVE THIS QUESTION USING C++
You Have To Solve This Question Using C 1
You Have To Solve This Question Using C 1 (105.69 KiB) Viewed 36 times
You have to make a simulator of cricket match. Make two teams of 11 players each. Each player will have his name, runs scored, balls faced, balls bowled, runs given, wickets taken. [use 1D/2D arrays]. Your match simulation will be performed using excessive use of random function. The execution of the simulation will be in the following order Match will be simulated for N number of overs. Value of N will be read from the configuration.txt file. [use filing] Toss will be done and any team can win the toss and bat first. [random function] Player 1 and Player 2 of the batting team will appear on the score card. Player 1 will face the first ball. Later on, the batsman facing the ball will be decided as follows: [setw()] o Score 1,3,5 will mean other end batsman will face next ball. o Over completed means other end batsman will face next ball. Bowler 1 will be the last player of Team B. Bowler 2 will be the second last player of team B and so on. Last fiver players of Team B will be bowlers. Each bowler can bowl a maximum of total_overs/5 overs (e.g. for a 20 over match, maximum overs bowled by a bowler would be 4). Ball will be bowled by pressing ENTER key. Each ball bowled will get a hit which will get some score randomly (-1-6). If -1 comes, batsman is declared OUT. [Scoreboard changes will be done by clearing the screen and then drawing again with new values. You can use system("clear") function to clear the console and should have your own function to draw() scoreboard again with new values which should be passed to the function.] • All batsmen don't have same probability of getting out, that is, a bowler (player number 6 to 11) will have 50% chance of getting out on each ball and 50% of getting any score from 0-6. Similarly, a batsman (player number 1 to 5) will have 10% chance of getting out and 90% chance of getting score 0-6 on each ball.

APAKISTAN INNINGS (50 overs maximum) BATTING SR Aamer Sohail ✓c+Stewart b Pringle 21.05 Ramiz Raja ✓lbw b Pringle 30.76 ✓c Illingworth b Botham 72 5 Imran Khan (c) 65.45 0 Javed Miandad ✓c Botham billingworth 58 59.18 ✓b Pringle 42 4 0 Inzamam-ul-Haq 120.00 Wasim Akram 33 0 ✓run out (†Stewart) 4 183.33 Saleem Malik not out 0 1 2 0 0 0.00 TOTAL 50 Ov (RR: 4.98) 249/6 Did not bat: Ijaz Ahmed, Moin Khan †. Mushtaq Ahmed, Aaqib Javed Fall of wickets: 1-20 (Aamer Sohail, 4.6 ov), 2-24 (Ramiz Raja, 8.2 ov), 3-163 (Javed Miandad, 39.3 ov), 4-197 (Imran Khan, 43.3 ov), 5-249 (Inzamam-ul-Haq 49.5 ov), 6-249 (Wasim Akram, 49.6 ov) BOWLING 0 M R W ECON WD NB 22 3v 2.20 3 5 Derek Pringle 52 Chris Lewis 0 5.20 1 2 lan Botham 42 1 v 6.00 1 0 42 10 0 Phil De Freitas 0 4.20 10 0 50 1v 5.00 0 0 Richard Illingworth Dermot Reeve 3 0 22 0 7.33 1 0 There should be a function to find total score to be displayed on the scorecard which is also displayed by a function. Total score is actually sum of scores of all players who batted. 10 10 7 2 2 0 1 R 4 8 19 26 110 98 35 18 M 20 36 159 125 46 21 45 0 1 65 0 0 1 0

There should be a function to find total score to be displayed on the scorecard which is also displayed by a function. Total score is actually sum of scores of all players who batted. Similarly, total dismissed is sum of all players who got out. If a batsman is DISMISSED/OUT, his score card will be displayed until ENTER is pressed again. After that, main score card is displayed again. [You can stop output until a key is pressed by using cin.get() function. And then clear the screen and then redraw Scoreboard] Javed Miandad ✓c Botham b Illingworth 58 98 125 59.18 The innings of the team playing first will end if all overs are bowled or all players are dismissed. In any case, full scorecard should be displayed showing full innings summary. • There should be a special key to press during the program which will prompt user to enter the over number to directly jump to; so that we can skip ENTER key for each ball and possibility to jump to a particular over or the end of innings directly. To make more interesting, you can introduce an optional short delay after each ball bowled so that you can see how match is proceeding. Seconds innings will be executed same as before except that the target, remaining score, remaining overs, required run rate is also included in the score card. You don't need to display first innings scoreboard when second innings is being played.

A ENGLAND INNINGS (Target: 250 runs from 50 overs) BATTING 6s SR Graham Gooch (c) ✓c Aaqib Javed b Mushtaq Ahmed 0 43.93 lan Botham ✓c+Moin Khan b Wasim Akram 0 0.00 Alec Stewart + ✓c+Moin Khan b Aaqib Javed 0 43.75 Graeme Hick ✓lbw b Mushtaq Ahmed 0 47.22 Neil Fairbrother ✓c+Moin Khan b Aaqib Javed 0 88.57 Allan Lamb ✓b Wasim Akram 0 75.60 Chris Lewis ✓b Wasim Akram 0 0.00 Dermot Reeve ✓c Ramiz Raja b Mushtaq Ahmed 15 0 46.87 Derek Pringle not out 18 0 112.50 Phil DeFreitas run out (Saleem Malik/+Moin Khan) 10 0 125.00 Richard Illingworth ✓c Ramiz Raja b Imran Khan 14 10 9 2 0 140.00 TOTAL 49.2 Ov (RR: 4.60) 227 Fall of wickets: 1-6 (lan Botham, 2.5 ov), 2-21 (Alec Stewart, 7.3 ov), 3-59 (Graeme Hick, 18.6 ov), 4-69 (Graham Gooch, 20.5 ov), 5-141 (Allan Lamb, 34.5 ov). 6-141 (Chris Lewis, 34.6 ov), 7-180 (Neil Fairbrother, 42.5 ov), 8-183 (Dermot Reeve, 43.6 ov), 9-208 (Phil DeFreitas, 47.1 ov). 10-227 (Richard Illingworth, 49.2 ov) BOWLING M R W ECON WD NB Wasim Akram 10 0 4.90 6 4 Aaqib Javed 10 2 2.70 Mushtaq Ahmed 10 4.10 Ijaz Ahmed 4.33 Imran Khan 6.78 Aamer Sohail 4.90 3 6.2 10 OOO 0 0 R 29 0 7 17 62 31 0 49 27 41 13 43 49 66 6 16 36 70 41 1 32 16 00 8 3 v 2 v 3 v 0 0 93 12 22 49 97 54 6 38 29 13 4s 1 O 1 1 3 2 0 0 1 0 3 1 2 0 1 1 O 0 1 0

When match is finished, user gets an option to show a short summary of the match, show first innings, show second innings, save match data on file, load a previous match data. [Use files to write and read match data, switch statement to display this menu] Result • Bowler taking highest wickets will be declared bowler of the match. Batsman scoring highest runs will be declared batsman of the match. Team winning will be shown as winner. • ●
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply