For this assignment, you will write a program called bb.c
,
which will help you manage your baseball team.
                
You don’t have to keep track of much: each player has a name, a player number, and a batting average.                 
You must store the team as an array of structures. The array must not be a global variable.                 
Here is a sample run. Your output must match exactly. User input looks like this.                 
% ./a.out Please rise for our national anthem. a name number average (add a player) h (help) q (quit) p (print all players) p number (print a single player) Command: p Player Num Average ======== === ======= Command: a Jack 12 42 Command: a Theresa 40 300 Command: a Babe 3 342 Command: p Player Num Average ======== === ======= Jack 12 .042 Theresa 40 .300 Babe 3 .342 Command: p 40 Player Num Average ======== === ======= Theresa 40 .300 Command: p 99 Player Num Average ======== === ======= Command: a Lou 3 125 The team already has a player #3. Command: p Player Num Average ======== === ======= Jack 12 .042 Theresa 40 .300 Babe 3 .342 Command: z Bad command 'z'. a name number average (add a player) h (help) q (quit) p (print all players) p number (print a single player) Command: h a name number average (add a player) h (help) q (quit) p (print all players) p number (print a single player) Command: q
z
”,
or a duplicate player number, and you must deal with that.
q
” command is entered.
Sorry: the team is full.
”
.042
#define
s are fine.
You will lose points if your program:
bb.c
fopen
without fclose
Use                 
~cs157/bin/checkin HW2 bb.c
or web checkin                 
Turn in someone else’s work.                 
Modified: 2017-08-26T16:41                  User: Guest                  Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |