Language: C++

#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;

//
class Node {
private:
	int key;
	Node *p_next = NULL;
	Node *p_prev = NULL;
public:
	Node(int k);
	void linkNext(Node n);
	void linkPrev(Node n);
	void getNext();
	void getPrev();
	bool hasKey(int k);
	void printKey();
};

Node::Node(int k)
{
	key = k;
}

void Node::linkNext(Node n)
{
	p_next = &n;
}

void Node::linkPrev(Node n)
{
	p_prev = &n;
}

Node Node::getNext()
{
	Node n = *p_next;
	return n;
}

Node Node::getPrev()
{
	Node n = *p_prev
	return n;
}

bool Node::hasKey(int k)
{
	return key == k;
}

void Node::printKey()
{
	cout << key;
}

//
class LinkedList {
private:
	Node dummy;
	void linkNode(Node n1, Node n2);
public:
	LinkedList();
	void insertNode(int x);
	void deleteNode(int x);
	void deleteFirst();
	void deleteLast();
	void print();
};

LinkedList::LinkedList()
{
	Node n(-1);
	n.linkNext(n);
	n.linkPrev(n);
	dummy = n;
}

void LinkedList::linkNode(Node n1, Node n2)
{
	n1.linkNext(n2);
	n2.linkPrev(n1);
}

void LinkedList::insertNode(int x)
{
	Node n(x);
	linkNode(n, dummy.getNext());
	linkNode(dummy, n);
}

void LinkedList::deleteNode(int x)
{
	Node n = dummy.getNext();
	while (!n.hasKey(x)) {
		if (n.hasKey(-1)) return;
		n = n.getNext();
	}
	
	linkNode(n.getPrev(), n.getNext());
}

void LinkedList::deleteFirst()
{
	linkNode(dummy, dummy.getNext().getNext());
}

void LinkedList::deleteLast()
{
	linkNode(dummy.getPrev().getPrev(), dummy);
}

void LinkedList::print()
{
	Node n = dummy.getNext();
	if (n.hasKey(-1)) return;
	while (1) {
		n.printKey();
		n = n.getNext();
		if (n.hasKey(-1)){
			cout << endl;
			break;
		} else {
			cout << " ";
		}
	}
}

//
int main(void)
{	
	LinkedList list;
	
	int n;
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		char command[12] = "\0";
		sin >> command;
		if (strcmp(command, "insert") == 0) {
			list.insertNode(cin);
		} else if (strcmp(command, "delete") == 0) {
			list.deleteNode(cin);
		} else if (strcmp(command, "deleteFirst") == 0) {
			list.deleteFirst();
		} else {
			list.deleteLast();
		}
	}

	list.print();
	
	return 0;
}

Compiler output:
a.cc:37:6: error: no declaration matches 'Node Node::getNext()'
   37 | Node Node::getNext()
      |      ^~~~
a.cc:16:14: note: candidate is: 'void Node::getNext()'
   16 |         void getNext();
      |              ^~~~~~~
a.cc:7:7: note: 'class Node' defined here
    7 | class Node {
      |       ^~~~
a.cc:43:6: error: no declaration matches 'Node Node::getPrev()'
   43 | Node Node::getPrev()
      |      ^~~~
a.cc:17:14: note: candidate is: 'void Node::getPrev()'
   17 |         void getPrev();
      |              ^~~~~~~
a.cc:7:7: note: 'class Node' defined here
    7 | class Node {
      |       ^~~~
a.cc: In constructor 'LinkedList::LinkedList()':
a.cc:73:24: error: no matching function for call to 'Node::Node()'
   73 | LinkedList::LinkedList()
      |                        ^
a.cc:22:1: note: candidate: 'Node::Node(int)'
   22 | Node::Node(int k)
      | ^~~~
a.cc:22:1: note:   candidate expects 1 argument, 0 provided
a.cc:7:7: note: candidate: 'constexpr Node::Node(const Node&)'
    7 | class Node {
      |       ^~~~
a.cc:7:7: note:   candidate expects 1 argument, 0 provided
a.cc:7:7: note: candidate: 'constexpr Node::Node(Node&&)'
a.cc:7:7: note:   candidate expects 1 argument, 0 provided
a.cc: In member function 'void LinkedList::insertNode(int)':
a.cc:90:34: error: invalid use of void expression
   90 |         linkNode(n, dummy.getNext());
      |                     ~~~~~~~~~~~~~^~
a.cc: In member function 'void LinkedList::deleteNode(int)':
a.cc:96:31: error: conversion from 'void' to non-scalar type 'Node' requested
   96 |         Node n = dummy.getNext();
      |                  ~~~~~~~~~~~~~^~
a.cc:99:31: error: no match for 'operator=' (operand types are 'Node' and 'void')
   99 |                 n = n.getNext();
      |                               ^
a.cc:7:7: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    7 | class Node {
      |       ^~~~
a.cc:7:7: note:   no known conversion for argument 1 from 'void' to 'const Node&'
a.cc:7:7: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:7:7: note:   no known conversion for argument 1 from 'void' to 'Node&&'
a.cc:102:27: error: invalid use of void expression
  102 |         linkNode(n.getPrev(), n.getNext());
      |                  ~~~~~~~~~^~
a.cc: In member function 'void LinkedList::deleteFirst()':
a.cc:107:38: error: invalid use of 'void'
  107 |         linkNode(dummy, dummy.getNext().getNext());
      |                         ~~~~~~~~~~~~~^~
a.cc: In member function 'void LinkedList::deleteLast()':
a.cc:112:31: error: invalid use of 'void'
  112 |         linkNode(dummy.getPrev().getPrev(), dummy);
      |                  ~~~~~~~~~~~~~^~
a.cc: In member function 'void LinkedList::print()':
a.cc:117:31: error: conversion from 'void' to non-scalar type 'Node' requested
  117 |         Node n = dummy.getNext();
      |                  ~~~~~~~~~~~~~^~
a.cc:121:31: error: no match for 'operator=' (operand types are 'Node' and 'void')
  121 |                 n = n.getNext();
      |                               ^
a.cc:7:7: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    7 | class Node {
      |       ^~~~
a.cc:7:7: note:   no known conversion for argument 1 from 'void' to 'const Node&'
a.cc:7:7: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:7:7: note:   no known conversion for argument 1 from 'void' to 'Node&&'
a.cc: In function 'int main()':
a.cc:141:17: error: 'sin' was not declared in this scope
  141 |                 sin >> command;
      |                 ^~~
a.cc:143:41: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
  143 |                         list.insertNode(cin);
      |                                         ^~~
      |                                         |
      |                                         std::istream {aka std::basic_istream<char>}
a.cc:87:33: note:   initializing argument 1 of 'void LinkedList::insertNode(int)'
   87 | void LinkedList::insertNode(int x)
      |                             ~~~~^
a.cc:145:41: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
  145 |                         list.deleteNode(cin);
      |                                         ^~~
      |                                         |
      |                                         std::istream {aka std::basic_istream<char>}
a.cc:94:33: note:   initializing argument 1 of 'void LinkedList::deleteNode(int)'
   94 | void LinkedList::deleteNode(int x)
      |                             ~~~~^