write a C++ program that store information about players who have been selected
ID: 3545259 • Letter: W
Question
write a C++ program that store information about players who have been selected as participants in a fantasy football league. the data for this program is given below, or can be saved in a file named fantasy.dat. This file contains the following information about each player: name, NFL team, position, and Fantasy league owner's name. Your program should read these data in an array of nested structures and then create an attractively formatted report listing the information.
file: fantasy.dat
ANDERSON SF K JOANN
TIMPSON PHIL WR JIM
ELWAY GEN QB JACKV
SALAAM CHI RB BILL
CARNEY SD K VINCE
SANDERS DET RB JOHN
CARTER MINN WR JACKR
FREEMAN GB WR ROM
WATTERS PHIL RB CHRIS
CHMURA GB TE STEVE
BELDSOE NE QB CHRIS
FAULK IND RB JIM
GEORGE TENN RB STEVE
BETTIS PITT RB JACKV
STEWART PITT QB BILL
DUBLEY OAK TE JOHN
MARINO MIA QB VINCE
KIRBY SF RB RON
WARREN SEA RB JACK
MARTIN NE RB JOANN
Explanation / Answer
class FantasyPlayer; // ... class Player { public: Player() : owner(0) { /* empty */ } FantastyPlayer* owner; // pointer to fantasy player who picked me }; std::vector all_players; // all available picks std::vector fantasy_players; // all pickers int iPicked = ...; // index of picked player in all_players int iPicker = ...; // index of fantasy player currently picking // create link between a player and its picker all_players[iPicked].owner = &(fantasy_players[iPicker]);Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.