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
#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;
}
Comments
Leave a comment