Pages

Thursday, 10 September 2015

C++ code to Print the values in Singly and Doubly Linked List

void myClass :: print()
{
cout << endl;
temp = head;

if (head == NULL)
{
cout << endl;
cout << " Sorry! Link List is empty" << endl;
cout << endl;
Sleep(1000);
return;
}

while (temp != NULL)
{
cout << temp->data << endl;
temp= temp->next;
}

system("pause");

}

No comments: