Answer to Question #250291 in C for gikovi

Question #250291

Create three database using header linked

              Student  (Roll No, Name, Branch ID, CGPA)

              University  (University ID, University Name, University Location, Year of start)

              Branch  (Branch ID, University ID, Branch Name)


Implement the following modules/ sub-modules using menu driven approach:

-> Delete all students whose CGPA<6.0 and store them in another list. They will come back to original student list if their CGPA>=6.0 (Update function)

-> Display the list of students reading in a specific University


1
Expert's answer
2021-10-12T13:50:39-0400


#include <malloc.h>
#include <stdio.h>
  
// Creating header linked list
struct database {
    int info;
    struct database* nextNode;
};
  


struct database* start = NULL;
  


struct database* create_header_list(int data)
{
  
    
    struct database *new_node, *node;
    new_node = (struct database*)    malloc(sizeof(struct database));
    new_node->info = data;
    new_node->nextNode = NULL;
  
    
    if (start == NULL) {
  
        
        start = (struct database*)  malloc(sizeof(struct database));
        start->nextNode = new_node;
    }
    else {
  
        
        node = start;
        while (node->nextNode != NULL) {
            node = node->nextNode;
        }
        node->nextNode = new_node;
    }
    return start;
}


struct database* display()
{
    struct database* node;
    node = start;
    node = node->nextNode;
    while (node != NULL) {
        printf("%d ", node->info);
        node = node->nextNode;
    }
    printf("\n");
    return start;
}


int main()
{
  
    
    create_header_list(11);
    create_header_list(12);
    create_header_list(13);
  
    
    display();
    create_header_list(14);
    create_header_list(15);
  
    
    display();
  
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS