Devam Ediyor

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: [url removed, login to view]

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: [url removed, login to view]

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: [url removed, login to view]

Games played: 2

Yards per game: [url removed, login to view]

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

Go Bills!

Beceriler: C++ Programlama

Daha fazlasını görün: two string problem, top programming, struct programming, struct cpp, string functions cpp, string cpp, string cplusplus, statistics problem sets, solve statistics, programming cpp, number problem games, declare string cpp, programming string functions, cpp struct, cpp string, cplusplus struct, cplusplus string, statistics r, runner, solve statistics problem, football game programming, entered values, football player program, homework problem, games runner

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

Proje NO: #6494420

Seçilen:

usmanahmad958

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 fazlası

1 gün içinde 10$ USD
(0 Değerlendirme)
0.0

4 freelancer bu iş için 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 30$ USD
(24 Değerlendirme)
4.2
vflosad

A proposal has not yet been provided

in 8 gün içinde25$ USD
(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 15$ USD
(0 Değerlendirme)
0.0
tai02101992

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

1 gün içinde 30$ USD
(0 Değerlendirme)
0.0