fork download
  1. void AddDirected(int x, int y)
  2. {
  3. node *new_node = new node;
  4. node *current_node = new node;
  5.  
  6. new_node->data = y;
  7. new_node->next = NULL;
  8.  
  9. current_node = List[x];
  10.  
  11.  
  12. if (current_node != NULL && current_node->data != y)
  13. {
  14.  
  15. while (current_node->next != NULL && current_node->data != y)
  16. {
  17. current_node = current_node->next;
  18. }
  19.  
  20. if (current_node->next == NULL)
  21. {
  22. if(current_node->data != y)
  23. {
  24. current_node->next = new_node;
  25. }
  26. }
  27. }
  28.  
  29. new_node = NULL;
  30. delete new_node;
  31.  
  32. current_node = NULL;
  33. delete current_node;
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void AddDirected(int, int)':
prog.cpp:3:5: error: 'node' was not declared in this scope
     node *new_node = new node;
     ^
prog.cpp:3:11: error: 'new_node' was not declared in this scope
     node *new_node = new node;
           ^
prog.cpp:3:26: error: 'node' does not name a type
     node *new_node = new node;
                          ^
prog.cpp:4:11: error: 'current_node' was not declared in this scope
     node *current_node = new node;
           ^
prog.cpp:4:30: error: 'node' does not name a type
     node *current_node = new node;
                              ^
prog.cpp:7:22: error: 'NULL' was not declared in this scope
     new_node->next = NULL;
                      ^
prog.cpp:9:20: error: 'List' was not declared in this scope
     current_node = List[x];
                    ^
prog.cpp:30:12: error: type '<type error>' argument given to 'delete', expected pointer
     delete new_node;
            ^
prog.cpp:33:12: error: type '<type error>' argument given to 'delete', expected pointer
     delete current_node;
            ^
stdout
Standard output is empty