Callington Posted July 28, 2021 Posted July 28, 2021 #include using namespace std; struct node { struct node* head; int date; struct node* later; }; struct node* headnode()//Create table header { struct node* head = new struct node; head->head = head; head->later = head; return head; } //Node struct node* headnode(int dat) { struct node* headnode = new struct node; headnode->date = dat; headnode->head = NULL; headnode->later = NULL; return headnode; } // void print(struct nodehead,int date)//Head insertion method { struct node newhead = headnode(date); newhead->head = head; newhead->later = head->later; head->later->head = newhead; newhead->later = newhead; } void printf(struct node* head)//print { struct node* newnode = head->later; while(newnode != head) { cout << newnode->date << endl; newnode = newnode->head; } } int main() { struct node* head = headnode(); print(head, 44); print(head, 33); print(head, 22); printf(head); cout << "Really hard" << endl; system("pause"); return 0; }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now