1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

just reply as welcome

Discussion in 'Meet and Greet' started by gunshot08, Jun 6, 2008.

  1. gunshot08

    gunshot08 New Member

    guys a new guy have just popped in from somewhere. he is new i mean very new. he only need some welcome messages from all the members so he will feel like he have entered the right site. His name is EDDY a COMPUTER SCIENCE student at the Univesity of ZIMBABWE. he is a cool guy ,just try to do as he said.
    this might seem out of topic but i had to do this.
    i hope u will respond.
    thanks guys.



    for private msgs use r076623j@cs.uz.ac.zw
    C U THERE
     
  2. shabbir

    shabbir Administrator Staff Member

    welcome
     
  3. Darkness1337

    Darkness1337 New Member

    hehey! welcome!
    like your avatar :D

    computer science? oh wow sounds great, hows it goin?
     
  4. gunshot08

    gunshot08 New Member

    i am glad

    im happy to have a respond from u guy, i love it. i have a problem to share with you. i ws given an assignment on double linked list to do a multipe tasks. i coded it but i was left with 5 errors i couldnt resolve. the program is like this




    Code:
    #include<stdio.h>
    #include<stdlib.h>
    #include<conio.h>
    #define NULL 0
    struct list
    {
       int data;
        struct list*next;
        struct list *prev;
    };
    typedef struct list node;
    node *find(node *,int);
    node *pre=NULL;
    node *fin=NULL;
    node *start;
    int main()
    {
          int menu(void);
          void create(node *);
          void display(node *);
          void insert(node *,int,int);
          void revdisplay(node *);
          void del(node *,int);
          int choice,ch;
          int data,tar;
          node *newrec;
          start=NULL;
    
    
    do
    {
      clrscr();
      choice=menu();
      switch(choice)
    	       {
    		case '1':
    		  printf("\nCreating the list");
    		  printf("Enter the terms(type 0 to end)\n");
    		  start=new node;
    		  create(start);
    break;
    		 case '2':
    		   if (start==NULL)
    		      printf("\nList does not exist");
    		   else
    		      {
    			printf("\nDisplaying the list\n");
    			display(start);
    			getch();
    		       }
    break;
    		 case '3':
    		 if (start==NULL)
    		   {
    		     printf("\nList does not exist");
    		     getch();
    			}
    		  else
    		    {
    		       printf("\nDisplaying the list:");
    
    			revdisplay(fin);
    		       }
    		   case '4':
    		      if(start==NULL)
    			{
    			 printf("\nList does not exist");
    			 getch();
    			  }
    		       else
    			{
    			 printf("\nEnter the term to insert:");
    			  scanf("%d",&data);
    			  printf("\nEnter target term:");
    			  scanf("%d",&tar);
    			  insert(start,data,tar);
    			 }
    break;
    		      case '5':
    			if(start==NULL)
    			  {
    			    printf("\nlist does not exist:");
    			    getch();
    			   }
    			  else {
    				 printf("\nEnter the term to delete:");
    				 scanf("%d",&data);
    				 del(start,data);
    			       }
    break;
    			 case '6':
    			   printf("\nExiting" );
    break;
    			 default:
    			    printf("\nNot a valid choice");
    			    getch();
    break;
    
    			}
    	  }
    while(choice!=6);
    getch();
    return(0);
    }
    int menu(void)
    {
    int ch;
    printf("\n1->Creation of the list");
    printf("\n2->Displaying of the list");
    printf("\n3->Displaying the list");
    printf("\n4->Insertion of the list");
    printf("\n5->Deletion of the list");
    printf("\n6->Reverse of the list");
    printf("\n7->Exit");
    printf("\nEnter your choice:");
    scanf("%d",ch);
    return(ch);
    }
    void create(node *record)
    {
    scanf("%d",&record->data);
    if(record->data==0)
    {
      record->next=NULL;
      record->prev=pre;
      fin=record->prev;
      pre=NULL;
    }
    else
    {
      record->prev=pre;
      record->next=new node;
      pre=record;
      create(record->next);
    }
    return;
    }
    void display(node *record)
    {
    if(record->next!=NULL)
    {
    printf("%d",display(record->next));
    }
    return;
    }
    void reverse(node *record)
    {
    if(record!=NULL)
    {
    printf("%c",display(record->prev));
    }
    return;
    void insert(node *record,int data,int target)
    {
    node *tag,*newrec,*temp;
    newrec=new node;
    if(record->data==target)
    {
    newrec->next=record;
    newrec->prev=NULL;
    record->prev=newrec;
    start=newrec;
    }
    else
    {
    tag=find(record,target);
    temp=tag->prev;
    tag->prev=newrec;
    newrec->next=tag;
    temp->next=newrec;
    }
    if(tag==NULL)
    {
    printf"Target item not present in the list\n");
    getch();
    return;
    }
    newrec->data=data;
    return;
    }
    void del(node *record,int target)
    {
    node *tag,*temp;
    if(record->data==target)
    {
    temp=record;
    start=start->next;
    start->prev=NULL;
    delete temp;
    }
    else
    { 
    tag=find(record,target);
    if(tag->next->next==NULL)
    {
    fin=fin->prev;
    fin->next=tag->next;
    }
    if(tag==NULL)
    {
    printf("Target item not present in the list\n");
    getch();
    return;
    }
    return;
    }
    node *find(node *record,int target)
    {
    if(record->next->data==target)
    {
    return(record);
    }
    else if(record->next==NULL)
    return(NULL);
    else
    find(record->next,target);
    }
    }
    

    hope u will help me to make it run
     
    Last edited by a moderator: Jun 9, 2008
  5. shabbir

    shabbir Administrator Staff Member

    Re: i am glad

    If you jump into any introduction thread and ask for help No one would even be able to know and see it and so I guess you should not expected more than a bashing
     

Share This Page