Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write two functions that read user input into a struct nba _ player variable, and print out each player in a more readable format. The
write two functions that read user input into a struct nbaplayer variable, and print out each player in a more readable format. The functions should have the following prototypes:
nbaplayer ReadStructFILE infile;
void PrintStructnbaplayer pl;
Loop through this ReadStruct PrintStruct loop until you receive fake NBA player with name "List Endington". Your output should match the following example, as well as the included test cases which will be piped to stdin but for reference are also stored in nba:
Player DeMar DeRozan
Player: DeMar DeRozan
Age:
G GS:
FG FGA FG:
P PA P:
P PA P:
FT FTA FT:
TRB ORB, DRB:
AST, STL BLK TOV:
Player Nikola Vuevi
Player: Nikola Vuevi
Age:
G GS:
FG FGA FG:
P PA P:
P PA P:
FT FTA FT:
TRB ORB, DRB:
AST, STL BLK TOV:
Player List Endington
#include
#include
typedef struct nbaplayers
int Rk; Rank were not sorting, so more of an ID for us
char Player; Player name include first and last name so s s and then convert to Player
int Age; Age
int G; Games played
int GS; Games started
int MP; Minutes played
int FG; Field goals baskets
int FGA; Field goal attempts shots
float FGP; Fieldgoal percentage
add the rest
nbaplayer;
nbaplayer ReadStructFILE infile;
void PrintStructnbaplayer player;
nbaplayer ReadStructFILE infile
nbaplayer pl;
char first last; You'll need to grab these separately and then convert to Player
Data format:
RkPlayer,Age,GGSMPFGFGA,FGPPAPPPAPeFGFTFTA,FTORB,DRBTRBAST,STLBLKTOV,PFPTS
Don't try to fit this all on one line!
fscanfinfileds s
d
&plRk first, last,
&plAge
;
Process first and last into plPlayer. sprintf is fine for this.
sprintfplPlayer,...
return pl;
void PrintStructnbaplayer pl
printf
Player: s
plPlayer;
printf Age: d
plAge;
printf G GS: d d
plG plGS;
printf FG FGA FG: d d f
plFG plFGA, plFGP;
return;
int mainvoid
int ID ;
while
printfPlayer d ID;
nbaplayer player ReadStructstdin;
What is our exit break condition?
PrintStructplayer;
return ;
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