Here is the Code: #include <stdio.h> #include <stdlib.h> #include <string.h> #in
ID: 3612803 • Letter: H
Question
Here is the Code:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
int main()
{int i,j;
char str[80];
bool isvowel;
char vowel[11]={"AEIOUaeiou"};
char *in;
FILE *file;
char * pch;
char wd[50];
if(!(file=fopen("input.txt","r")))
{
printf(" Error opening file ");
getch();
return 1;
}
in=fgets(str,80,file);
while(in!=NULL)
{pch = strtok (str," ,.-?!;:");
while (pch != NULL)
{ isvowel=false;
for(i=0;i<10;i++)
if(pch[0]==vowel[i])
isvowel=true;
if(isvowel)
{for(j=0;j<strlen(pch);j++)
if(pch[j]!=' ')
wd[j]=pch[j];
wd[j]='';
strcat(wd,"ay");
}
else
{for(j=1;j<strlen(pch);j++)
if(pch[j]!=' ')
wd[j-1]=pch[j];
wd[j]='';
strcat(wd,"ay");
}
for(j=0;j<strlen(wd);j++)
printf ("%c",wd[j]);
printf(" ");
pch = strtok (NULL, " ,.-?!;:");
}
printf(" ");
in=fgets(str,80,file);
}
getch();
return 0;
}
The input simply said: Walt Disney World is the most fun place onEarth.
The output wrote: altay isneyay orldyay isay heaay ostaay untaylaceyay onay Earthay.
Also what would this code write so the user can input any sentencerather than the program take it from a file?