Find Jobs
Hire Freelancers

C++ Basketball, structs, C-strings, and dynamic memory allocation

$10-30 USD

Completed
Posted about 8 years ago

$10-30 USD

Paid on delivery
Program Steps Read a file containing team names, their conferences and divisions. This data will be stored in an array of structs. Memory for each of the team names must be allocated dynamically. Read a file containing scores. Each record in the file must be parsed to determine the winning and losing team. The number of wins, losses and percentage must be calculated using the data in the scores file. The array of structs must be sorted by conference, division, and percentage to produce output equivalent to that shown below. Program Requirements Use the input files, team name file and scores file. Scores updated 1/17/16 (games played through 1/17/16) Use this struct to store the data for each team: struct NBA_Team { char* name; char conference[8]; char division[10]; unsigned short wins; unsigned short losses; float pct; }; Use char arrays to store all character data for this assignment. The C++ string class may not be used in this assignment. The program output must show the current standings using the team input data and the percentage calculations. Program Output Your output should look quite similar to the following. Note: the actual statistics will be different when you use the current scores file. Output updated 1/17/16 (contains games played through 1/17/16) Western Conference Southwest Division W L Pct San Antonio Spurs 36 6 0.857 Memphis Grizzlies 23 19 0.548 Dallas Mavericks 23 19 0.548 Houston Rockets 21 20 0.512 New Orleans Pelicans 13 26 0.333 Pacific Division W L Pct Golden State Warriors 37 4 0.902 Los Angeles Clippers 26 14 0.650 Sacramento Kings 17 23 0.425 Phoenix Suns 13 29 0.310 Los Angeles Lakers 9 33 0.214 Northwest Division W L Pct Oklahoma City Thunder 30 12 0.714 Utah Jazz 18 22 0.450 Portland Trail Blazers 18 25 0.419 Denver Nuggets 16 25 0.390 Minnesota Timberwolves 13 29 0.310 Eastern Conference Southeast Division W L Pct Atlanta Hawks 24 17 0.585 Miami Heat 23 18 0.561 Orlando Magic 20 19 0.513 Washington Wizards 19 20 0.487 Charlotte Hornets 18 22 0.450 Central Division W L Pct Cleveland Cavaliers 28 10 0.737 Chicago Bulls 23 16 0.590 Detroit Pistons 22 18 0.550 Indiana Pacers 22 19 0.537 Milwaukee Bucks 18 25 0.419 Atlantic Division W L Pct Toronto Raptors 25 15 0.625 Boston Celtics 22 19 0.537 New York Knicks 20 22 0.476 Brooklyn Nets 11 30 0.268 Philadelphia 76ers 5 37 0.119 Program Notes There are 30 NBA teams, 15 in each conference. The conferences are Western and Eastern. There are 6 divisions with 5 teams in each division. The scores file will also require specific parsing techniques. Skip over the date and time columns (the first 12 bytes). Skip over the mostly blank records that show the tie score before overtime. To parse a scores record, you can use strncpy and strtok(). To calculate the team percentage, use the formula: pct = wins / total games played To sort the data for the output standings, you might want to create a "sortkey" function, consisting of the conference, division, and percentage. Then you can sort using the "sortkey". And finally, as usual, this assignment contains some subtle aspects. Be sure to start early and allow enough time to ask the instructor for help. Recommendation, when you start, use a small subset of the scores file to make sure you are correctly calculating the statistics.
Project ID: 9685800

About the project

4 proposals
Remote project
Active 8 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
$20 USD in 0 day
2.8 (3 reviews)
2.4
2.4
4 freelancers are bidding on average $35 USD for this job
User Avatar
A proposal has not yet been provided
$49 USD in 1 day
5.0 (39 reviews)
6.1
6.1

About the client

Flag of UNITED STATES
Saratoga, United States
0.0
0
Payment method verified
Member since Feb 17, 2016

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.