i am write program that insert at tail in circular singlelinkedlist
but i have some errors ..

#include<iostream.h>
struct node {
	int info ;
	node * next ;
};
class clist{
private :
	node *tail;
	int size;
public:
	clist(){
		tail=NULL;
		size=0;
		void addtail(int x){
			node *p=new node;
			p->info=x;
			if(tail==NULL)
			p->next=p;
			tail=p;
		}
		else
		{
			node *q=tail->next;
			tail->next=p;
			p->next=q;}
		size++;}
	};

int main()
{
	a.clist;
	int x;
	int size;
	cout<<":LLL"
		cin>>size;
	for(int i=0;i<size;i++)
		a.addtail(x);
}

the questin is ,, insert at tail of circular linkedlist ,,and display the list
then if the size is odd traverse forward .
print element forward
and if size is even print element backword ...

plz .. i realy need to study my exam :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.