Implementation of interface for mathematical Set Theory using C programming.
Giving two list of data as input to get the output as union & intersection for given list of data.
#include "list.h"
int main()
{
int first_list_nodes = 0,second_list_nodes = 0,first_list_items = 0,
second_list_items = 0;
printf("enter the number of Nodes in first list:");
fflush(stdout);
scanf("%d",&first_list_nodes);
printf("enter %d the elements:",first_list_nodes);
for(int i = 0;i < first_list_nodes;i++)
{
fflush(stdout);
scanf("%d",&first_list_items);
head1 = insert_node(head1,first_list_items);
}
display_list(head1);
printf("\nEnter the number of Nodes in seconds list:");
fflush(stdout);
scanf("%d",&second_list_nodes);
printf("enter %d the elements:",second_list_nodes);
for(int i = 0;i < second_list_nodes;i++)
{
fflush(stdout);
scanf("%d",&second_list_items);
head2 = insert_node(head2,second_list_items);
}
display_list(head2);
res_union = get_union(head1,head2);
#ifdef DEBUG_MAIN
printf("\nValue of head1 and head2 :%d %d",head1,head2);
#endif
#ifdef DEBUG_MAIN
printf("\nValue of head1 and head2 after performing union :%d %d\n",head1,head2);
printf("value of res_union : %d\n",res_union);
#endif
printf("here is the result of union:");
display_list(res_union);
res_intersection = get_intersection(head1,head2);
#ifdef DEBUG_MAIN
printf("\nValue of head1 and head2 after performing union : %d %d\n",head1,head2);
printf("value of res_intersection : %d\n",res_intersection);
#endif
printf("Here is the result of intersection: ");
display_list(res_intersection);
}