diff --git a/submissions/2018955_task01/2018955_task01.cpp b/submissions/2018955_task01/2018955_task01.cpp new file mode 100644 index 0000000..4650f6c --- /dev/null +++ b/submissions/2018955_task01/2018955_task01.cpp @@ -0,0 +1,60 @@ +#include + +using namespace std; + +int main() +{ + int arr1[1000], arr2[1000], conArr[2000]; + + int n1, n2; + + int i, x; + + cout<<"Enter the Size for First Array : "; + + cin>>n1; + + cout<>arr1[i]; + + conArr[i] = arr1[i]; + } + + x = i; + + cout<>n2; + + cout<>arr2[i]; + + conArr[x] = arr2[i]; + + x++; + } + + cout< + +using namespace std; + +struct node +{ + int data; + + struct node *next; +}; + +void push(struct node **head_ref, int data) +{ + struct node *node; + + node = (struct node*)malloc(sizeof(struct node)); + + node->data = data; + + node->next = (*head_ref); + + (*head_ref) = node; +} + +void reverse(struct node **head_ref) +{ + struct node *temp = NULL; + + struct node *prev = NULL; + + struct node *current = (*head_ref); + + while(current != NULL) + { + temp = current->next; + + current->next = prev; + + prev = current; + + current = temp; + } + + (*head_ref) = prev; + +} + +void printnodes(struct node *head) +{ + while(head != NULL) + { + cout<data<<" "; + + head = head->next; + } +} + + +int main() +{ + struct node *head = NULL; + + push(&head, 45); + + push(&head, 23); + + push(&head, 98); + + push(&head, 12); + + push(&head, 36); + + push(&head, 84); + + cout << "List before reversing" << endl; + + printnodes(head); + + reverse(&head); + + cout << endl; + + cout << "List after reversing"<