Em Andamento

C++ program using structs, C-strings, and dynamic memory allocation

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

Use this struct to store the data for each team:

struct NFL_Team

{

char* name;

char conference[9];

char division[6];

unsigned short wins;

unsigned short losses;

unsigned short ties;

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 11/3/14

National Football Conference

NFC WEST W L T Pct

Seattle 8 1 0 [url removed, login to view]

San Francisco 6 2 0 [url removed, login to view]

Arizona 4 4 0 [url removed, login to view]

St. Louis 3 6 0 [url removed, login to view]

NFC SOUTH W L T Pct

New Orleans 6 2 0 [url removed, login to view]

Carolina 5 3 0 [url removed, login to view]

Atlanta 2 6 0 [url removed, login to view]

Tampa Bay 0 8 0 [url removed, login to view]

NFC NORTH W L T Pct

Green Bay 5 2 0 [url removed, login to view]

Detroit 5 3 0 [url removed, login to view]

Chicago 4 3 0 [url removed, login to view]

Minnesota 1 7 0 [url removed, login to view]

NFC EAST W L T Pct

Dallas 5 4 0 [url removed, login to view]

Philadelphia 4 5 0 [url removed, login to view]

Washington 3 5 0 [url removed, login to view]

NY Giants 2 6 0 [url removed, login to view]

American Football Conference

AFC WEST W L T Pct

Kansas City 9 0 0 [url removed, login to view]

Denver 7 1 0 [url removed, login to view]

San Diego 4 4 0 [url removed, login to view]

Oakland 3 5 0 [url removed, login to view]

AFC SOUTH W L T Pct

Indianapolis 5 2 0 [url removed, login to view]

Tennessee 4 4 0 [url removed, login to view]

Houston 2 5 0 [url removed, login to view]

Jacksonville 0 8 0 [url removed, login to view]

AFC NORTH W L T Pct

Cincinnati 6 3 0 [url removed, login to view]

Cleveland 4 5 0 [url removed, login to view]

Baltimore 3 5 0 [url removed, login to view]

Pittsburgh 2 6 0 [url removed, login to view]

AFC EAST W L T Pct

New England 7 2 0 [url removed, login to view]

NY Jets 5 4 0 [url removed, login to view]

Miami 4 4 0 [url removed, login to view]

Buffalo 3 6 0 [url removed, login to view]

Program Notes

There are 32 NFL teams, 16 in each conference. The conferences are National and American. There are 4 divisions with 4 teams in each division. The divisions are NORTH, SOUTH, EAST and WEST.

To read the team file, you will have to specifically look for conference records and division records.

The scores file will also require specific parsing techniques. To skip over the date and week records, you can look for the text, "SUN", "MON", ... , or "Week". To parse a scores record, you can use strtok(), looking for a comma. It will be handy to write a function that can pick out a team name from a text String. The strstr() function might be useful here.

To calculate the team percentage, use the formula:

pct = (wins + 0.5 * ties) / 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.

Habilidades: Programação C++

Ver mais: team national, struct programming, strings programming, string cplusplus, south l, sort array, programming techniques, programming program, programming conferences, parsing input, nfl programming, miami data, jacksonville north carolina, float programming, dynamic programming techniques, string programming, sort function, programming strings, programming char, programming arrays, programming array strings, cplusplus struct, cplusplus strings, cplusplus string, cplusplus sort array

Acerca do Empregador:
( 22 comentários ) Sunnyvale, United States

ID do Projeto: #5094756

Premiar a:

nani01029x

I have done some projects in programming. I have very strong profile with some positive feedbacks from the students around the world. You can check my profile for more detail. Let me help you. I'm ready to get started Mais

$15 USD em 1 dia
(25 Avaliações)
4.2

9 freelancers estão ofertando em média $26 para este trabalho

Alexnick

Hello there. I am proficient in C++ and I am interested in offering you a professional solution to your project. If I understand correctly, the program is to be implemented in C++, but you cannot use STL containers (ve Mais

$30 USD in 2 dias
(2 Comentários)
2.2
anatol1988

Hello. I can do it for positive response. I have great C++/C experience also and this task is really for me :)

$15 USD in 3 dias
(2 Comentários)
2.2
oobretenov

I could help you. . Mais

$35 USD em 1 dia
(1 Comentário)
1.1
gregrc

Hello. I am experianced C++ developer with +10 years of real projects. Is your task admits STL or any library for solve?

$25 USD em 1 dia
(0 Comentários)
0.0
fenix710

I Software developer and databases over 7 years on C++. The work will be done it in a day. Thank you.

$30 USD em 1 dia
(0 Comentários)
0.0
rightfreelancer7

I am a professional software engineer with 9+ years of experience. I am very talented programmer with the following skills c, c++ , java. my skill set and experience are best suitable for your requirement. Please assi Mais

$30 USD em 1 dia
(0 Comentários)
0.0
armujahid

we are working as a group of hardworking and passionate engineering students. we love to work. we can work in pressure. we have strong programming and debugging skills. . we love to code in C/C++. they program you are Mais

$25 USD em 1 dia
(0 Comentários)
0.0
Ravi1G

Hi I am Expert In C++ I have already done this type of project Please check my current Project Thank You

$30 USD in 2 dias
(0 Comentários)
0.0