Starting from:

$30

COM2067 LAB 3 -Solved

 we have given you a main.c and function.h files. The main.c file contains only the int main() function, while the function.h file will consist of the definitions of all the other functions you will use in this application. Complete the function.h file so that the main.cpp file works without error to generate the expected output. First, check the main.c file carefully. You can examine SimpleTutorial.pdf document to define functions in a separate file.

 Fenerbahce and Galatasaray supporters are waiting in separate lines to get tickets. For each group of fans, get the related information (id and age for FB fans, id for GS fans) from the user and create the following link lists. FB fans will be inserted to link list in increasing order, GS fans in decreasing order with respect to their IDs. The number of fans in both link lists will be the same. The node structures to be used in the link list are given below.  

  struct nodeFB 



          int id;            int age; 

          struct nodeFB *next; 

}; 
struct nodeGS 



          int id;           struct nodeGS *next; 
You are then asked to combine these two linked lists using the following way. Use the new node structures when you are doing this placement.

   
struct newNodeFB 



          int id;           int age;            struct newNodeGS *next; 

}; 
struct newNodeGS 



          int id;           struct newNodeFB *next; 

}; 
 


Input: 
Output: 
456 45 

561 41 

821 20 

193 25 

882 37 

-1   

872 

272 

345 

892 

764 -1 

 
193 25 

456 45 

561 41 

821 20 

882 37 

 

892 

872 

764 

345 

272 
 

193 25 

892 

456 45 

872 

561 41 

764 

821 20 

345 

882 37 

272 

More products