I have to take a sentence, and turn it into pig latin. I can get the sentence to come in no problem, but when I go to deciper each word into the Pig Latin, it looks at the whole sentence string instead of just one word at a time. I also have to take into account punctuation. Should I be using the substring, or the .find or what?? I'm stumped. :crazy:
i m giving u the word extracting program..once u can extract all the words in a sentence then u can handle each words one by one... Code: # include<stdio.h> # include<conio.h> # include<malloc.h> # include<string.h> void main() { int i=0,j=0,k=0; char temp[10]; char p[50]; //maximum length of the sentence char q[10][10]; //maximum number of words it can hold is 10 and each having maximum size 10 clrscr(); gets(p); //get the string while(p[i]!='\0') { if(p[i]==' ') { temp[j]='\0'; j=0; strcpy(q[k],temp); ++k; ++i; } else { temp[j]=p[i]; j++; i++; } } temp[j]='\0'; strcpy(q[k],temp); for(i=0;i<=k;i++) puts(q[i]); //finally the 2d array contains all the words. getch(); //run the program by giving sample senetence "this is my book" }