Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The purpose of this assignment is to give you practice using structs, C-stings,

ID: 3668319 • Letter: T

Question

The purpose of this assignment is to give you practice using structs, C-stings, C-string functions, and dynamic memory allocation.

************************************************************************************************************************************************************

Program Steps

1. 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.

2. 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.

3. 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(http://voyager.deanza.edu/~bentley/NBA_Teams.txt)

and scores file. (http://voyager.deanza.edu/~bentley/NBA_Scores.txt)

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 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.

************************************************************************************************************************************************************

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 San Antonio Spurs Memphis Grizzlies Dallas Mavericks Houston Rockets New Orleans Pelicans 36 23 23 21 13 Pct 6 0.857 19 0.548 19 0.548 20 0.512 26 0.333 Pacific Division Golden State Warriors 37 Los Angeles Clippers 26 Sacramento Kings Phoenix Suns Los Angeles Lakers Pct 4 0.902 14 0.650 23 0.425 29 0.310 33 0.214 17 13 Northwest Division Oklahoma City Thunder 30 Utah Jazz Portland Trail Blazers 18 Denver Nuggets Minnesota Timberwolves 13 Pct 12 0.714 22 0.450 25 0.419 25 0.390 29 0.310 18 16 Eastern Conference Southeast Division Atlanta Hawks Miami Heat Orlando Magic Washington Wizards Charlotte Hornets 24 23 20 19 18 Pct 17 0.585 18 0.561 19 0.513 20 0.487 22 0.450 Central Division Cleveland Cavaliers Chicago Bulls Detroit Pistons Indiana Pacers Milwaukee Bucks Pct 10 0.737 16 0.590 18 0.550 19 0.537 25 0.419 28 23 18 Atlantic Division TorontoRaptors Boston Celtics New York Knicks Brooklyn Nets Philadelphia 76ers Pct 15 0.625 19 0.537 22 0.476 30 0.268 37 0.119 25 20

Explanation / Answer

Hi!

I'll enter the code only for 17.1 data from the given data file.

Just you copy paste all remaining data from that

Text file to understand whole thing.

#include<studio.h>

#include<string. h>

struct NBA_Team
{

unsigned int wins = 12;

unsigned int games played = 17;

float p ;

};

// answer will be continue to all data ,

//copy the same template and try the answer.

//its a partially completed because of time limit.