Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the class DoublyLinkedList completed in the previous exercise, write a pro

ID: 3676584 • Letter: U

Question

Using the class DoublyLinkedList completed in the previous exercise, write a program to store all the prime numbers up to 100 in a DoublyLinkedList object. The numbers should be stored in such a way that when “display” is invoked, the listing will be shown in increasing order: 2, 3, 5, 7, 11, 13, 17, … .

Explanation / Answer

#include #include #include struct node { //struct node *prev; int num; struct node *nxt; }*head; void store(int value){ struct node *var, *temp; var = (struct node *)malloc(sizeof(struct node)); var->num = value; if(head==NULL){ head = var; head->nxt = NULL; }else{ temp = var; temp->nxt = head; head=temp; } } void accept(int value, int i){ if(inxt; y = temp->num; x = temp2->num; primeloop(x,y); } int primeloop(int x,int y){ int num; if ( x == 1 ) x++; if(x
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote