View Single Post
Old 05-22-2005, 12:29 PM   #1 (permalink)
rogue
Registered User
 
Join Date: Apr 2005
Posts: 9
rogue is on a distinguished road
hey redhead quick question about c/c++

I am making a pig latin code. I have most of it worked out but getting it to take off constantsand then moving them to the end of the word before adding ay is giving me alot of trouble. this is what i have so far.




Quote:
/*Pig Latin*/
/*Valerie*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
int x=0;
int y=0;
int wordcount=0;
char fword[80];
char oneword[80];

void translate (void);
int main()
{
printf("\n\tWelcome to Pig Latin.Please enter a sentence you would like to tranlate\n");
fgets(fword,81, stdin);
printf("\n%s\n",fword);
while (fword[x]!='\0')
{
while (fword[x]!= ' ' && fword[x] != '.')
{
printf("%c",fword[x]);
oneword[y]=fword[x];
++y;
++x;
}
if (fword[x] == '.')
{
oneword[y]='\0';
translate();
break;
}
else
{
printf("\n");
oneword[y]='\0';
translate();
++x;
y = 0;
}
}
getch();
}

void translate (void)

{
++wordcount;
printf("\n I will translate %s \n ",oneword);
char oneword;
int temp;
int v;
{
while (oneword !='a' && oneword !='e' && oneword !='i' && oneword !='o' && oneword !='u'&& oneword !='y')
--oneword;
++v;
v=temp;
printf("\n\t%c %iay",oneword,temp);
printf("\n\n\n\t The number of words is %i",wordcount);
}

}
Sorry i forgot to add my question. how do i takje a word entered. and then take off the constants and move them to the end of the word. i thought this was correct but its not.




Thanks
~Valerie

Last edited by rogue; 05-22-2005 at 02:08 PM. Reason: to make sure i have this the way valmont wants it.
rogue is offline   Reply With Quote