Question
Using the code provided below, which simulates a American football game, create code to show text to visualize the two separate halves of the football
Using the code provided below, which simulates a American football game, create code to show text to visualize the two separate halves of the football game along with creating some team specific attributes
For example, let's say Team 1 has an offensive rating of 10 out of 10, whereas Team 2 has an offensive rating of 8 out of 10. Factor the offensive rating into your score generator so that more times than not, Team 1 will score more points.
#include
using namespace std;
int main() { int home = 0; int away = 0; int total = 0; int winner = 0; int i; int j; int k; int l; int m; int n; int x; int y; int z; int a; int b; int c; int d; int e; int f; int g; int h; int overtime = 0;
default_random_engine engine; normal_distribution
for(i = 0; i < 2; i++) { for(j = 0; j < 15; j++) { total = ceil(distribution(engine)); if(i == 0) { home += total; } else { away += total; } } }
if(home == away) { overtime = 1; }
if(overtime == 1) { default_random_engine engine2; uniform_int_distribution
if(home > away) { winner = 1; } else { winner = 2; }
if(overtime == 0) { cout << "Home: " << home << endl << "Away: " << away << endl; } if(overtime == 1) { cout << "Home: " << home << endl << "Away: " << away << endl << "Overtime" << endl; }
cout << "Winner: "; if(winner == 1) { cout << "Home"; } if(winner == 2) { cout << "Away"; }
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started