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)
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.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.