I have no idea about how to do the part below
I am a new learner and I could not finish createPiglatinVersion part
thanks
create a Pig Latin version of the original string (may be several words, for the whole line of input) and save in another string --MAKE SURE YOU DON'T GO OUTSIDE THE ARRAY BOUNDS, and DON'T CHANGE THE ORIGINAL STRING! Be sure to copy the non-letters to the new string, and copy the pig-latin versions of the words in place of an input word to the new string
Here is the work I have done
<pre lang="cs">#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define FLUSH while (getchar() != '\n')
#define MAX_SIZE 256
#define WORD_SIZE 46
void getString (void);
void createPiglatinVersion(char *inputStr);
int getWord (char *inputStr,char *wordStr, int index);
void getPigLatin(char *temp, char *wordStr, int index);
bool isVowel(char oneword);
void printString(char *inputStr, char *outputStr);
bool repeatFcn(void);
int main (void)
{
char oneword='y';
printf("%d",isVowel(oneword));
system("pause");
return 0;
}
void getString (void)
{
char inputStr[MAX_SIZE];
printf("\nEnter a sentence (end with [Enter]):");
fgets(inputStr, sizeof(inputStr), stdin);
while (strlen(inputStr)>255)
{
FLUSH;
}
}
void createPiglatinVersion(char *inputStr)
{
char outputStr[MAX_SIZE];
char temp[WORD_SIZE];
char wordStr[WORD_SIZE];
int index = 0;
int i;
for(i=0, i<MAX_SIZE, ++i)
{
outputStr
getWord ( inputStr,wordStr, index);
getPigLatin( temp, wordStr, index);
}
}
int getWord (char *inputStr,char *wordStr, int index)
{
int i;
for (i=0;i<WORD_SIZE&&isalpha(inputStr[index]);++i);
{
wordStr[i]=inputStr[index];
index++;
}
wordStr[i]='\0';
return index;
}
void getPigLatin(char *temp, char *wordStr, int index)
{
if(isVowel(*wordStr)!=false&&isVowel(*wordStr+1))
{
strcpy(temp, wordStr);
temp[strlen(temp)+1]='\0';
strcat(temp,"ay");
}
else if(isVowel(*wordStr)!=false&& isVowel(*wordStr+1)!=false)
{
strcpy(temp,wordStr+2);
temp[strlen(temp)]=*(--wordStr);
temp[strlen(temp)-1]=*(wordStr-2);
temp[strlen(temp)+1]= '\0';
strcat(temp,"AY");
}
else if(isVowel(*wordStr))
{
strcpy(temp, wordStr);
temp[strlen(temp)+1]='\0';
strcat(temp,"way");
}
}
bool isVowel(char oneword)
{
oneword = toupper(oneword);
return ((oneword=='A' || oneword=='E' || oneword=='I' || oneword=='O' || oneword=='U')&&(oneword!='Y'));
}
void printString(char *inputStr, char *outputStr)
{
printf("The string you entered: %c\n", *inputStr);
printf("The string converted to Pig Latin: %c\n", *outputStr);
}
bool repeatFcn(void)
{
char check;
printf("\nTry another? (y for yes): ");
scanf(" %c", &check);
if(check=='Y'||check=='y')
return true;
else
return false;
}