6 Replies - 479 Views - Last Post: 02 March 2011 - 03:08 AM Rate Topic: -----

#1 qazqa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-February 11

sending a set of word with a particular pattern into a linked list

Posted 26 February 2011 - 08:34 AM

Hi guys,

I would be grateful if anyone could help me with this.

I need to send set of word into a linked list.The words which i want to send will all be have the same pattern...I wanna know how do i go about this...for eg. all the word tat are tagged as JJ in my file should be sent into a linked list!

Thank you
Is This A Good Question/Topic? 0
  • +

Replies To: sending a set of word with a particular pattern into a linked list

#2 Astraeus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 23
  • View blog
  • Posts: 205
  • Joined: 17-November 09

Re: sending a set of word with a particular pattern into a linked list

Posted 26 February 2011 - 09:09 AM

Have you attempted anything? How is your text file set up?
Was This Post Helpful? 0
  • +
  • -

#3 qazqa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-February 11

Re: sending a set of word with a particular pattern into a linked list

Posted 26 February 2011 - 10:40 PM

well i know how to send the text file into a linked list but here i want a particular pattern in the text file to go into a linked list.
My text file looks like this:

I_PRP personally_RB feel_VBP this_DT is_VBZ not_RB bad_JJ an_DT idea_NN ._.
This_DT is_VBZ not_RB good_JJ ._.
It_PRP is_VBZ a_DT wonderful_JJ day_NN today_NN ._.
I_PRP hope_VBP it_PRP stays_VBZ long_RB ._.
I_PRP have_VBP the_DT best_JJS idea_NN ._.

All the words with the tags _JJ and _RB, i need to put it into a linked list...Any idea how do i do this?

Thank you
Was This Post Helpful? 0
  • +
  • -

#4 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: sending a set of word with a particular pattern into a linked list

Posted 27 February 2011 - 04:01 AM

View Postqazqa, on 27 February 2011 - 03:40 PM, said:

All the words with the tags _JJ and _RB, i need to put it into a linked list...Any idea how do i do this?


An if() test would seem to be in order here.

Show us some code (in the form of a compilable program) that tries to do this and answer these questions about that code:
( a ) Does your code compile?
( b ) Any errors or warnings? If there are then share them with us.
Copy and paste the errors exactly as they are.
( c ) Is the program producing any output?
( d ) How is the actual output different to what you want / expect?
Give details and, ideally, examples.
If you provided inputs to the program tell us what they were.
( e ) What have you already tried to fix it?
Was This Post Helpful? 0
  • +
  • -

#5 qazqa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-February 11

Re: sending a set of word with a particular pattern into a linked list

Posted 01 March 2011 - 09:03 PM

Our code looks like this...our aim was to create 2 linked lists. To one linked list all th adjectives should be sent. Each adjective in different nodes. In the other linked list same thing should happen to adverbs.
Right now all the adjectives and adverbs are getting displayed in a single node.I would like to know how to get in different nodes?


struct node
{

char adj[key];

struct node *link;
};typedef struct node *NODE;
struct node1
{
char adv[key];


struct node1 *link;
};
typedef struct node1 *NODE1;

NODE1 getnod()
{
NODE1 x;
x=(NODE1)malloc(sizeof(struct node1));

if(x==NULL)
{
printf("out of memory");
exit(0);
}
return x;
}

NODE getnode()
{
NODE x;
x=(NODE)malloc(sizeof(struct node));

if(x==NULL)
{
printf("out of memory");
exit(0);
}
return x;
}

NODE inser(char jj[200],NODE first)
{
NODE temp;
temp=getnode();

strcpy(temp->adj,jj);

temp->link=first;

return temp;

}
NODE1 insert(char rb[200],NODE1 first)
{
NODE1 temp;
temp=getnod();

strcpy(temp->adv,rb);

temp->link=first;

return temp;

}
void disp(NODE1 first){
NODE1 temp;
if(first==NULL)
printf("list empty");
temp=first;

printf("\n%s==adv",first->adv);


}
void dis(NODE first){
NODE temp;
if(first==NULL)
printf("list empty");
temp=first;

printf("\n%s==adj",first->adj);


}
void posout()
{

//rest of our code come here


switch(i)
{
/*inside switch we wil be getting our adv and adj so we call it here in 2 diff cases*/

case 'J':strcpy(jj,read_output);
fprintf (fpresult, " \t%s --->Adjective",read_output);
first=inser(jj,first);
dis(first);

break;
case 'R': fprintf (fpresult2, " \t%s---> Adverb", read_output);

strcpy(rb,read_output);
first=insert(rb,first);
disp(first);
break;

}
}


Was This Post Helpful? 0
  • +
  • -

#6 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: sending a set of word with a particular pattern into a linked list

Posted 02 March 2011 - 02:37 AM

Please edit your posting (see the "EDIT" button in lower right). (If Edit is not available make a new posting on this thread and skip ( a ) below.)
( a ) Delete all your code.
( b ) Get a fresh copy of the code with formatting in place from your editor / IDE.
( c ) Paste the formatted code between code tags like this :code:
Read here for more help with the code tags
http://www.dreaminco...-code-tags-are/
( d ) Use the "Preview Post" button to check it's all good.
( e ) Use the "Submit Modified Post" button to finish the editing.
Was This Post Helpful? 0
  • +
  • -

#7 qazqa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-February 11

Re: sending a set of word with a particular pattern into a linked list

Posted 02 March 2011 - 03:08 AM

well well Thank you I solved my problem!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1