codes/data_file/teaminfo.txt // 2019 MLS Soccer team standings // Format: // Team_name" Nickname" league conference #wins-#losses-#ties // // Team name:String (char[30]) containing the name of the...

The questions is attached as picture. It's only one question with different part, please make sure to do all the parts (these parts are to make the question easy to follow). The codes are already there I attached them you just need to modify and add some functions


codes/data_file/teaminfo.txt // 2019 MLS Soccer team standings // Format: // Team_name" Nickname" league conference #wins-#losses-#ties // // Team name:String (char[30]) containing the name of the team - '_' for spaces // Nickname: String (char[5]) containing the nick name of the team // League:int containing 1 for MSL, 2 for NWSL, 3 for USL, 0 for other // Conference:int containing 1 for Eastern, 2 for Western, 3 for NWSL, 0 for other // #wins:int containing the number of games won during the regular season // #losses:int containing the number of games lost during the regular season // #draws:int containing the number of games drawn (ties) during the regular season New_York_City_FC NYC 1 1 18-6-10 Atlanta_United_FC ATL 1 1 18-12-4 Philadelphia_Union PHI 1 1 16-11-7 Toronto_FC TOR 1 1 13-10-11 D._C._United DC 1 1 13-10-11 New_York_Red_Bulls RBNY 1 1 14-14-6 New_England_Revolution NE 1 1 11-11-12 Chicago_Fire CHI 1 1 10-12-12 Montreal_Impact MTL 1 1 12-17-5 Columbus_Crew_SC CLB 1 1 10-16-8 Orlando_City_FC ORL 1 1 9-15-10 FC Cincinnati CIN 1 1 6-22-6 Los_Angeles_Football_Club LA 1 2 21-4-9 Seattle_Sounders SEA 1 2 16-10-8 Real_Salt_Lake RSL 1 2 16-13-5 Minnesota_United_FC MIN 1 2 15-11-8 LA_Galaxy LA 1 2 15-15-3 Portland_Timbers POR 1 2 14-13-7 FC_Dallas DAL 1 2 13-12-9 San_Jose_Earthquakes SJ 1 2 13-16-5 Colorado_Rapids COL 1 2 12-16-6 Houston_Dynamo HOU 1 2 12-18-4 Sporting_Kansas_City SKC 1 2 10-16-8 Vancouver_Whitecaps_FC VAN 1 2 8-16-10 codes/linked_list_adt/LinkedList.c /* * LinkedList.c - Linked List ADT * * Originator: Roy Kravitz ([email protected]) * Author: Hamed AlSaeghi * * This is the source code file for a Linked List ADT that * implements a singly linked list. I've tried to define the * API in a way that we can change implementations but keep * the API the same * * @note Code is based on DynamicStack.c from Narasimha Karumanchi * @note Data Structures and Algorithms Made Easy, Career Monk Publishers, 2016 * * @note Prints messages to stdio. This is Karumanchi's doing */ #include #include #include "LinkedList.h" // API functions /** * Creates a new instance of the Linked List * * @returnsPointer to the new Linked List instance if it succeeds. NULL if it fails */ LinkedListPtr_t createLList(void) { LinkedListPtr_t L = (LinkedListPtr_t) malloc(sizeof(LinkedList_t)); if(!L) return NULL; L->head = NULL; L->count = 0; return L; } /** * Returns the number of items in the list * * @param L is a Pointer to a LinkedList instance * * @returnsReturns the number of nodes in the linked list */ int LListLength(LinkedListPtr_t L){ return L->count; } /** * Inserts a new node into the linked list * * @param L is a Pointer to a LinkedList instance * @param data is the data item to put into the ndw node * @param pos is the position in the list to insert the item * * @returnsvoid */ void insertNodeInLList(LinkedListPtr_t L, int data, int pos){ ListNodePtr_t head = L->head; ListNodePtr_t q, p; ListNodePtr_t newNode = (ListNodePtr_t) malloc(sizeof(ListNode_t)); int k = 1; if(!newNode){ printf("LinkedList ADT: Memory Error\n"); return; } newNode->data = data; p = head; if ((pos == 1) || (p == NULL)){ newNode->next = head; L->head = newNode; L->count++; } else { while((p != NULL) && (k < pos)){="" k++;="" q="p;" p="p-">next; } newNode->next = q->next; q->next = newNode; L->count++; } } /** * Deletes a new node into the linked list * * @param L is a Pointer to a LinkedList instance * @param pos is the position in the list to insert the item * * @returnsvoid */ void deleteNodeFromLLinkedList(LinkedListPtr_t L, int pos) { ListNodePtr_t head = L->head; ListNodePtr_t q, p; int k = 1; p = head; if(head == NULL){ printf("LinkedList ADT: List Empty\n"); return; } else if( pos == 1){ L->head = head->next; free(p); L->count--; } else { while((p!=NULL) && (k < pos)){="" k++;="" q="p;" p="p-">next; } if(p == NULL){ printf("LinkedList ADT: Position does not exist\n"); } else{ q->next = p->next; free(p); L->count--; } } } /** * Prints all of the data items in the Linked List * * @param L is a Pointer to a LinkedList instance * * @returnsvoid */ void printLList(LinkedListPtr_t L) { ListNodePtr_t head = L->head; while(head != NULL){ printf("%d ", head->data); head = head->next; } printf("\n"); } codes/linked_list_adt/LinkedList.h /** * LinkedList.h - Linked List ADT header file (from HW #2 solution) * * Originator: Roy Kravitz ([email protected]) * Author: * * This is the header file for a Linked list ADT that * implements a pointer-based singly linked list * * @note Code is based on SinglyLinkedList.c from Narasimha Karumanchi * @note Data Structures and Algorithms Made Easy, Career Monk Publishers, 2016 */ #ifndef _LINKEDLIST_H_ #define _LINKEDLIST_H_ // include required header files #include #include #include // define the struct that contains a node in the linked list typedef struct listNode{ int data;// data for the node struct listNode *next;// next pointer for the node } ListNode_t, *ListNodePtr_t; // define the struct that contains an instance of the Linked List typedef struct LinkedList { ListNodePtr_t head;// pointer to the head node of the list int count;// number of elements on the list } LinkedList_t, *LinkedListPtr_t; // function prototypes LinkedListPtr_t createLList(void); int LListLength(LinkedListPtr_t L); void insertNodeInLList(LinkedListPtr_t L, int data, int pos); void deleteNodeFromLLinkedList(LinkedListPtr_t L, int pos); void printLList(LinkedListPtr_t L); #endif codes/linked_list_adt/LinkedList.h.gch codes/starter_code/teamInfo.c /* * teamInfo.c - Team info source code file for mls app * * Originator: Roy Kravitz ([email protected]) * Author: Hamed AlSaeghi * * This is the source code file that for functionality specific to the Team Info database that * is part of an ECE 361 homework assignment. * * This file, and its associated header file (including the functions that you * need to provide) are meant to be used by your Linked List ADT and main() to deliver * the functionality required in the assignment * * @note: You need to provide the code for several of these functions */ // include files #include #include #include #include #include "teamInfo.h" // constants #define MAX_TEAMS 100 #define NUM_OF_FIELDS_PER_RECORD 7 /** * Creates a new Team Info record * * @param name (pointer to a char[]) containing the name of the team * @param nickname (pointer to a char[]) containing the nickname of the team * @param league (int) containing the league the team plays in (MLS, NWSL, USL, Other) * @param conf (int) containing the conference the team plays in (Eastern, Wsstern, NWSL, Other} * @param nwins (int) containing the number of wins during the regular season * @param nlosses (int) containing the number of losses during the regular season * @param ndraws (int) containing the number of draws during the regular season * * @returns a pointer to a new TeamInfo record. */ TeamInfoPtr_t createTeamInfoRecord(const char* name, const char* nickname, int league, int conf, int nwins, int nlosses, int ndraws) { // ADD YOUR CODE HERE } /** * Displays the information from a team record on stdout * * @param teamInfoPtr (pointer to the team record) being examined * * @returns nothing */ void displayTeamInto(TeamInfoPtr_t teamInfoPtr) { // ADD YOUR CODE HERE // Note the helper functions at the end of this file. } /** * readTeamInfo() - reads the team info from a file * and creates an array of pointers to team Info records * * @param fname (pointer to char[]) file name of team info file to read * @param teams (pointer to array of team info records) array to put pointers to team records into * * @returns the number of team records read and stored * * @note You may have to include part (or all) of the absolute path in the file name. It depends * on what directory(s) you are building and running your application from */ int readTeamInfo(char* fname, TeamInfoPtr_t teams[]) { FILE *fp; // pointer to team info file char buf[100]; // input buffer // holding variables for fields in the team info record char tir_name[MAX_TEAM_NAME]; char tir_nickname[MAX_TEAM_NICKNAME]; int tir_league; int tir_conf; int tir_wins; int tir_losses; int tir_draws; int nfields = 0;// number of fields read from file int nrecs = 0; // number of records TeamInfoPtr_t tir;// pointer to team info record // open the team info file for reading if ((fp = fopen(fname, "r")) == NULL) { fprintf(stderr, "readTeamInfo: Could not open team info file: %s (%s)\n", fname, strerror(errno)); exit(1); } tir =
Nov 10, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here