# Runner using struct

Declare a struct called runner that represents statistics for a football running back. It contains the following fields:

name: a string which is the players last name

yards: the integer number of yards the player has run

carries: the integer number of times the player has carried the ball

ypc: a double value giving the average number of yards per carry

games: the integer number of games played

Write a program, [url removed, login to view], that uses the runner struct. It keeps the struct updated using user entered values. The program first prompts the user for the player name. It should initialize all of the numeric values in the struct to zero.

The program then repeatedly reads and executes the following character commands (an error message should be printed for entry of an illegal command):

r: Prompts the user for the length of a run. Adds one to the number of carries and adds the user entered value to the number of yards. Computes and updates yards per carry.

g: Sets the number of games to the user entered value.

p: Prints the player’s statistics in a nice format. This includes the player’s name, yards, carries, yards per carry, and games played. If the player has played more than zero games, the yards per game should also be printed. The print function will need to compute this. The double values should be printed with two digits after the decimal.

q: Quits the program.

Write your program using a top down design. You are required to use at least four user defined functions to solve the problem.

When done, place your completed [url removed, login to view] source file in the Homework 4 Drop Box on Blackboard.

Here is a sample run of the program (user input in bold). Your

Enter the name of the running back: Spiller

Enter r (run), g (games), p (print), or q (quit): r

Enter the length of the run: 13

Enter r (run), g (games), p (print), or q (quit): r

Enter the length of the run: 6

Enter r (run), g (games), p (print), or q (quit): r

Enter the length of the run: 1

Enter r (run), g (games), p (print), or q (quit): r

Enter the length of the run: -2

Enter r (run), g (games), p (print), or q (quit): p

Statistics for Spiller

Total yards: 18

Total carries: 4

Yards per carry: 4.50

Games: 0

Enter r (run), g (games), p (print), or q (quit): r

Enter the length of the run: 33

Enter r (run), g (games), p (print), or q (quit): p

Statistics for Spiller

Total yards: 51

Total carries: 5

Yards per carry: 10.20

Games: 0

Enter r (run), g (games), p (print), or q (quit): k

Illegal input, enter r, g, p, or q!

Enter r (run), g (games), p (print), or q (quit): g

Enter the number of games Spiller has played: 2

Enter r (run), g (games), p (print), or q (quit): p

Statistics for Spiller

Total yards: 51

Total carries: 5

Yards per carry: 10.20

Games played: 2

Yards per game: 25.50

Enter r (run), g (games), p (print), or q (quit): q

Go Bills!

Beceriler: C++ Programlama

İşveren Hakkında:
( 3 değerlendirme ) new york, United States

Proje NO: #6494420

## Seçilen:

Seems like school assignment. I have good programming skills especially in C++. And these little school assignments are not a problem for me. I will also help you in understanding codes in case if you are interested. H Daha Fazla

1 gün içinde %selectedBids___i_sum_sub_4%%project_currencyDetails_sign_sub_5% USD
(0 Değerlendirme)
0.0

## Bu iş için 4 freelancer ortalamada \$24 teklif veriyor

vietcompro

Hi there, I've already read and understood the project description, and I can complete this one for you. So really hope to have chance to work with you, thanks for your consideration! Regards.

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(24 Değerlendirme)
4.2

A proposal has not yet been provided

in %bids___i_period_sub_35% gün içinde25%project_currencyDetails_sign_sub_37% %project_currencyDetails_code_sub_38%
(0 Değerlendirme)
0.0
shabax

I am good in C++ and i have already managed the same type of projects. And i am sure i can handle this within a day with low rates.

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(0 Değerlendirme)
0.0
tai02101992

Предложение еще не подано

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(0 Değerlendirme)
0.0