Создайте связанный список, используя разные конструкторыC++

Программы на C++. Форум разработчиков
Anonymous
Создайте связанный список, используя разные конструкторы

Сообщение Anonymous »

Код: Выделить всё

#include
using namespace std;

class node
{
public:
int data;
node* next;

node()                  //default constructor
{
data = 0;
next = NULL;
}
node(int value)         //parameterize constructor
{
data = value;
next = NULL;
}
};

int main()
{
node* n = new node();   //no argument
cout

Подробнее здесь: [url]https://stackoverflow.com/questions/78720070/create-a-linked-list-using-different-constructors[/url]

Вернуться в «C++»