954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

piglatin program with fgets, strtok, and strlen

This is what I have so far, but I must incorporate the fgets, strtok, and strlen, to meet my professors requirements.

#include "stdio.h"
#include "string.h"

main()
{
  char word[40], latin[40], temp[40], vowels[6] = "aeiou";
char *foundat, *i, *j;
int where;
     printf("Enter a word\n");
     gets(word);
     foundat = '\0';
     i = vowels;
     for (i = vowels; *i, i++)
      {
            for (j = word; *j; j++)
            {
             if (*j == *i)
              {
                if(!foundat) foundat = j;
                else if (j < foundat) foundat = j;
                 break;
                  }
              }
        }
  printf("\n found at %s,*foundat);

i = latinn;
for (j = foundat; *j; j++)
{
  *i = *j;
   i ++;
   }

for (j = word; j != foundat; j++)
{
  *i = *j;
   i++;
}
*i = '\0';

printf("\n reversed is %s", latin);

*i++ = 'a';
*i++ = 'y';
*i = '\0';
printf("\n pig latin is %s", latin);


return;
}
jamieerr
Newbie Poster
1 post since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You