c ++: create two linked lists and then create a third list of links with duplicate data nodes of both

A friend of the mines needed help. I wanted to build two linked lists and then compare them to see if they had the same data values. Finally, a third list of links would contain the nodes with duplicate data. The linked list contains int data by the way. I reworked his code and pretended to be as simple and clean as possible, but I have a trembling sensation. Below is my code and its code together. I feel that there is something to learn from both, so I published both codes, although my solution is completely finished. Is my code simple and clean? Is my friend's code formatted in such a way that my code is not present? I look good in the eyes. The criticism of both solutions would help me grow a little.

Laurent code

#include 
#include 

using namespace std;

Structure node
Next * node;
int data
};

LinkedList class {
private:
int length;
Node * head;
public:
Linked list ();
~ LinkedList ();
Node * getHead ();
void appendToTail (int data);
void appendExistingNodesToTail (Node * newtail, int data); // Take a collection of node pointers. This is used to add existing nodes from other lists to your own list.
void insertToHead (int data);
empty print ();
};
LinkedList :: LinkedList () {
this-> length = 0;
this-> head = NULL;
}
LinkedList :: ~ LinkedList () {
// avoid memory leaks ... return what you take
Node * next = head;
Node * cur = NULL;
while (next! = NULL) {
cur = next;
next = next-> next;
delete cur;
}
cout << "LIST DELETED" << endl;
}
Node* LinkedList::getHead(){
    return head;
}
void LinkedList::appendToTail(int data){
    Node *newtail = new Node;
    newtail->data = data;
newtail-> next = nullptr;

if (this-> head == nullptr) {
head = newtail;
}
else {
Node * temp = head;
while (temp-> next! = nullptr) {
temp = temp-> next;
}
temp-> next = newtail;
this-> length ++;
}
}
void LinkedList :: appendExistingNodesToTail (Node * newtail, int data) {
newtail = new node;
newtail-> data = data;
newtail-> next = nullptr;

if (this-> head == nullptr) {
head = newtail;
}
else {
Node * temp = head;
while (temp-> next! = nullptr) {
temp = temp-> next;
}
temp-> next = newtail;
this-> length ++;
}
}
void LinkedList :: insertToHead (int data) {
Node * newhead = new node;
new head-> data = data;
newhead-> next = this-> head;
this-> head = newhead;
this-> length ++;
}
void LinkedList :: print () {
Node * head = this-> head;
int i = 1;
while (head) {
std :: cout << i << ":" << head->data << std::endl;
        head = head->following;
i ++;
}
cout << endl;
}
//-------------------------------------GENERAL PURPOSE FUNCTIONS------------------------------------------//
void generateDuplicateNodeDataFound(LinkedList* list_a, LinkedList* list_b, LinkedList* list_c){ //Find the duplicate values to build up list c from existing nodes from list a&b. Need two list to compare, one list to build
    Node* head1 = list_a->getHead ();
Node * head2 = list_b-> getHead ();

while (head1) {
while (head2) {
if (head1-> data == head2-> data) {
list_c-> appendExistingNodesToTail (head1, head1-> data);
break;
}
head2 = head2-> next;
}
head1 = head1-> next;
head2 = list_b-> getHead (); // Restart
}
}
int main (int argc, char const * argv[]) {

LinkedList * list1 = new LinkedList ();
LinkedList * list2 = new LinkedList ();
LinkedList * list_found_duplicates = new LinkedList ();

int arr1[] = {2,5,7,9,0,2};
int arr2[] = {9,78,3,2,5,9};

//https://stackoverflow.com/questions/37538/how-do-i-determine-the-size-of-my-array-in-c
int length = sizeof (arr1) / sizeof (arr1[0]);
for (int i = 0; iappendToTail (arr1[i]);
}
length = sizeof (arr2) / sizeof (arr2[0]);
for (int i = 0; iappendToTail (arr2[i]);
}

list1-> print ();
list2-> print ();

generateDuplicateNodeDataFound (list1, list2, list_found_duplicates);
list_found_duplicates-> print ();

delete list1;
delete list2;
delete list_found_duplicates;

cin >> arr1[0];

returns 0;
}

Laurent's friend code

#include 
#include 
using namespace std;
class node {
public:
Node (int value = 0, Node * nextNode = nullptr);
void insertAfter (Node * newPtr);
Node * getNext ();
int getValue ();
private:
int val;
Node * nextNodePtr;
};
Node :: Node (int value, Node * next node) {
this-> val = value;
this-> nextNodePtr = nextNode;
}
void Node :: insertAfter (Node * newPtr) {
Node * tempPtr = nullptr;
tempPtr = this-> nextNodePtr;
this-> nextNodePtr = newPtr;
newPtr-> nextNodePtr = tempPtr;
}
Node * Node :: getNext () {
return nextNodePtr;
}
int Node :: getValue () {
return this-> val;
}

bool search (int Key, Node * temp) {
bool found = false;
if (temp! = nullptr) {
while (Key! = temp-> getValue ()) {
temp = temp-> getNext ();
cout << Key << "," <getValue () <getNext () == 0) {
found = false;
break;
}
}
if (Key == temp-> getValue ()) {
found = true;
}
}
return found
}
// tries to intersect
Empty intersection (Node * start1, Node * start2, Node * node) {
Node * node1 = start1;
Node * node2 = start2;
Node * temp = nullptr;
cout << " n! I'm here!  n";
while (node1! = nullptr) {
cout << " n" <getValue () << " n";
cout <<"n!i am here now!n";
    if (search(node1->getValue (), node2)) {
node-> insertAfter (node1);
node = node-> getNext ();
}
node1 = node1-> getNext ();

}

}
// print tastes list
void printList (Node * home) {

while (start-> getNext ()! = nullptr) {
cout <getValue () <<" ";
    start= start->getNext ();
}
cout <getValue ();
cout << endl << endl;
}
// fusion algorithm
void merge (Node * start, Node * end, Node * node) {
cout <getValue () <<" ";
  while(start->getNext ()! = nullptr) {
cout <getValue () <<" ";
    node->insertAfter (start);
node = node-> getNext ();
start = start-> getNext ();
}
while (end-> getNext ()! = nullptr) {
cout <getValue () <<" ";
    node->insertAfter (end);
end = end-> getNext ();
}
}


int main () {
Node * new1 = nullptr;
Node * new2 = nullptr;
Node * new3 = nullptr;
int arr[]= {2,5,7,9,0,2};
new1 = new node (arr[0]);
new3 = new1;
for (int i = 1; i<6;i++){
    new2 = new Node(arr[i]);
    new3->insertAfter (new2);
new3 = new2;
}
printList (new1);
cout << endl;
Node * newst = nullptr;
new2 = nullptr;
new3 = nullptr;
int arr1[]= {9,78,3,2,5,9};
newst = new Node (arr1[0]);
new3 = newst;
for (int i = 1; i<6;i++){
    new2 = new Node(arr1[i]);
    new3->insertAfter (new2);
new3 = new2;
}

cout << endl;

printList (newst);
if (search (1, new1)) {
cout << "ll  n";
}
cout << " nll  n";
if (search (7, newst)) {
cout << "lol  n";
}
Node * inter = new node (0);
intersect (new1, newst, inter);
printList (inter);
}


int main () {
Node * new1 = nullptr;
Node * new2 = nullptr;
Node * new3 = nullptr;
int arr[]= {2,5,7,9,0,2};
new1 = new node (arr[0]);
new3 = new1;
for (int i = 1; i<6;i++){
    new2 = new Node(arr[i]);
    new3->insertAfter (new2);
new3 = new2;
}
printList (new1);
cout << endl;
Node * newst = nullptr;
new2 = nullptr;
new3 = nullptr;
int arr1[]= {9,78,3,2,5,9};
newst = new Node (arr1[0]);
new3 = newst;
for (int i = 1; i<6;i++){
    new2 = new Node(arr1[i]);
    new3->insertAfter (new2);
new3 = new2;
}

cout << endl;

printList (newst);
if (search (1, new1)) {
cout << "ll  n";
}
cout << " nll  n";
if (search (7, newst)) {
cout << "lol  n";
}
Node * inter = new node (0);
intersect (new1, newst, inter);
printList (inter);
}