Language: C++

#include <iostream>
using namespace std;

class Node{
public:
  Node* prev;
  Node* next;
  int data;
  Node(prev=0;next=0;data=0);
}
class list{
private:
  Node head;
public:
  List(){head.prev=&head; head.next=&head;}
  int insert(int x){
    Node* p = new Node();
    if(p == 0)
      return -1;
    Node* q = &head;
    Node* r = head.next;
    p->prev = q;
    p->next = r;
    p->data = x;
    q->next = p;
    r->prev = p;

    return 0;
  }
  int del(int x){
    for(Node* p = head.next ; p != &head ; p = p->next){
      if(p.data == x){
        (p->prev)->next = p->next;
        (p->next)->prev = p->prev;
        delete p;
      }
    }
  }
  int deleteFirst(){
    head.next = (head.next)->next;
    ((head.next)->next)->prev = head;
    delete head.next;
  }
  int deleteLast(){
    head.prev = head.prev->prev;
    head.prev->prev->next = head;
  }
  void print(){
    for(Node* p = head.next ; p != &head ; p = p->next){
      cout << p->data;
      if(p->nwxt != &head){
        cout << ' ';
      } else {
        cout << endl;
      }
    }
  }
}
int main(){
  int n,d;
  string str;
  list p;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> str;
    if(str == "insert"){
      cin >> d;
      p.insert(d);
    } else if(str == "delete"){
      cin >> d;
      p.del(d);
    } else if(str == "deleteFirst"){
      deleteFirst();
    } else {
      deleteLast();
    }
  }
  p.print();
}



Compiler output:
a.cc:9:12: error: expected ')' before '=' token
    9 |   Node(prev=0;next=0;data=0);
      |       ~    ^
      |            )
a.cc:9:15: error: 'next' does not name a type
    9 |   Node(prev=0;next=0;data=0);
      |               ^~~~
a.cc:9:22: error: 'data' does not name a type
    9 |   Node(prev=0;next=0;data=0);
      |                      ^~~~
a.cc:10:2: error: expected ';' after class definition
   10 | }
      |  ^
      |  ;
a.cc:15:3: error: ISO C++ forbids declaration of 'List' with no type [-fpermissive]
   15 |   List(){head.prev=&head; head.next=&head;}
      |   ^~~~
a.cc:58:2: error: expected ';' after class definition
   58 | }
      |  ^
      |  ;
a.cc: In member function 'int list::List()':
a.cc:15:43: warning: no return statement in function returning non-void [-Wreturn-type]
   15 |   List(){head.prev=&head; head.next=&head;}
      |                                           ^
a.cc: In member function 'int list::del(int)':
a.cc:32:12: error: request for member 'data' in 'p', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   32 |       if(p.data == x){
      |            ^~~~
a.cc:38:3: warning: no return statement in function returning non-void [-Wreturn-type]
   38 |   }
      |   ^
a.cc: In member function 'int list::deleteFirst()':
a.cc:41:33: error: cannot convert 'Node' to 'Node*' in assignment
   41 |     ((head.next)->next)->prev = head;
      |                                 ^~~~
      |                                 |
      |                                 Node
a.cc:43:3: warning: no return statement in function returning non-void [-Wreturn-type]
   43 |   }
      |   ^
a.cc: In member function 'int list::deleteLast()':
a.cc:46:29: error: cannot convert 'Node' to 'Node*' in assignment
   46 |     head.prev->prev->next = head;
      |                             ^~~~
      |                             |
      |                             Node
a.cc:47:3: warning: no return statement in function returning non-void [-Wreturn-type]
   47 |   }
      |   ^
a.cc: In member function 'void list::print()':
a.cc:51:13: error: 'class Node' has no member named 'nwxt'; did you mean 'next'?
   51 |       if(p->nwxt != &head){
      |             ^~~~
      |             next
a.cc: In function 'int main()':
a.cc:73:7: error: 'deleteFirst' was not declared in this scope
   73 |       deleteFirst();
      |       ^~~~~~~~~~~
a.cc:75:7: error: 'deleteLast' was not declared in this scope
   75 |       deleteLast();
      |       ^~~~~~~~~~