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()
{
	return *p_next;
}

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

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:42:6: error: no declaration matches 'Node Node::getPrev()'
   42 | 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:71:24: error: no matching function for call to 'Node::Node()'
   71 | 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:88:34: error: invalid use of void expression
   88 |         linkNode(n, dummy.getNext());
      |                     ~~~~~~~~~~~~~^~
a.cc: In member function 'void LinkedList::deleteNode(int)':
a.cc:94:31: error: conversion from 'void' to non-scalar type 'Node' requested
   94 |         Node n = dummy.getNext();
      |                  ~~~~~~~~~~~~~^~
a.cc:97:31: error: no match for 'operator=' (operand types are 'Node' and 'void')
   97 |                 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:100:27: error: invalid use of void expression
  100 |         linkNode(n.getPrev(), n.getNext());
      |                  ~~~~~~~~~^~
a.cc: In member function 'void LinkedList::deleteFirst()':
a.cc:105:38: error: invalid use of 'void'
  105 |         linkNode(dummy, dummy.getNext().getNext());
      |                         ~~~~~~~~~~~~~^~
a.cc: In member function 'void LinkedList::deleteLast()':
a.cc:110:31: error: invalid use of 'void'
  110 |         linkNode(dummy.getPrev().getPrev(), dummy);
      |                  ~~~~~~~~~~~~~^~
a.cc: In member function 'void LinkedList::print()':
a.cc:115:31: error: conversion from 'void' to non-scalar type 'Node' requested
  115 |         Node n = dummy.getNext();
      |                  ~~~~~~~~~~~~~^~
a.cc:119:31: error: no match for 'operator=' (operand types are 'Node' and 'void')
  119 |                 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:139:17: error: 'sin' was not declared in this scope
  139 |                 sin >> command;
      |                 ^~~
a.cc:141:41: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
  141 |                         list.insertNode(cin);
      |                                         ^~~
      |                                         |
      |                                         std::istream {aka std::basic_istream<char>}
a.cc:85:33: note:   initializing argument 1 of 'void LinkedList::insertNode(int)'
   85 | void LinkedList::insertNode(int x)
      |                             ~~~~^
a.cc:143:41: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
  143 |                         list.deleteNode(cin);
      |                                         ^~~
      |                                         |
      |                                         std::istream {aka std::basic_istream<char>}
a.cc:92:33: note:   initializing argument 1 of 'void LinkedList::deleteNode(int)'
   92 | void LinkedList::deleteNode(int x)
      |                             ~~~~^