Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct list {
- float val;
- list* next;
- list* prev;
- };
- int main()
- {
- int n;
- scanf_s("%d", &n);
- list* head = new list;
- head->prev = NULL;
- float c;
- scanf_s("%f", &c);
- head->val = c;
- list* temp = head;
- for (int i = 2; i <= n; i++)
- {
- scanf_s("%f", &c);
- temp->next = new list;
- temp->next->val = c;
- temp->next->prev = temp->next;
- temp = temp->next;
- }
- temp->next = head;
- head->prev = temp;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement