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");

}

Saturday, 5 September 2015

C++ Program to insert a new nod and Value in Doubly Link List


#include <iostream>
using namespace std;

struct nod
{
int data;
nod *next;
nod *prev;
};

class myClass
{
private:
nod *head;
nod *temp;

public:
myClass()
{
head = NULL;
temp = NULL;
}

void insert();
void print();
};

Saturday, 29 August 2015

C++ Program to insert a new nod and Value in Singly Link List


#include <iostream>
using namespace std;

struct nod
{
int data;
nod *next;
};

class myClass
{
private:

nod *head;
nod *current;
nod *temp;

public:
myClass()
{
head = NULL;
current = NULL;
}


void insert();

};

Monday, 24 August 2015

C++ Program to check whether a number is palindrome or not (through pointers)


#include <iostream>
using namespace std;

class palinDrome
{
private:

char *myInput;
char *inverted;
int size;


public:
palinDrome()
{
myInput = NULL;
inverted = NULL;
size = 0;
}


void input();
void check();
};