TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Software World > Programming

Pig-Latin C-Language (no C++)

Programming

 
Reply
Thread Tools Display Modes
Unread 24-08-2013, 07:47 AM   #1
Newbie
Thread Starter
 
Join Date: Jul 2013
Age: 24
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Mood: Asleep
Rep Power: 0 rbin23 is an unknown quantity at this point

Intel Nvidia

Windows 7


Pig-Latin C-Language (no C++)

I need help on this:

#include<stdio.h>
#include<conio.h>
#include<string.h>

void stradd(char *str,char a)
{
int i;
for(i=0;str[i]!='\0';i++);
str[i++]=a;
str[i]='\0';
}

void main()
{
char *p, str[50], lat[50]="", eng[50], add[]="ay";

printf("Enter a line: \n");
gets(eng);

strcpy(str,eng);
p=strtok(str," ");
while(p!=NULL)
{
strcat(lat,&p[1]);
stradd(lat,p[0]);
strcat(lat,add);
p=strtok(NULL," ");
if(p!=NULL) stradd(lat,' ');
}
printf("\n\n English: %s\n Pig-Latin: %s",eng,lat);
getch();
}


as you can see, its already a full functioning program with one problem.
First what is pig-latin:GOOGLE IT

For words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and "ay" is added, as in the following examples:

HAPPY-> APPYHAY....DUCK->UCKDAY

The letter 'y' can play the role of either consonant or vowel, depending on its location:

YELLOW->ELLOWYAY....RHYTHM->YTHMRAY

and last, also my PROBLEM:

For words that begin with vowel sounds or silent letter, "way" is added at the end of the word. Examples are:

EGG->EGGWAY....INBOX->INBOXWAY....EIGHT->EIGHTWAY

Please help me with this please.... you can change it any other way you want so long as it has the same answer

Sponsored Links
rbin23 is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Language: Server collation (Latin) differs 4crm4 Microsoft Dynamics CRM 0 26-06-2008 02:01 PM
Email subject changes from Hebrew to Latin Internet Surfer Microsoft Outlook 4 20-06-2008 04:35 PM
Latin has limited support, how can I fix this? RobertoDole Microsoft Office Word 8 19-03-2008 04:18 AM
Compatibility between latin and sql_latin collation Zekske Microsoft SQL Server 6 05-12-2007 04:27 PM
How to change Asian layout to Latin alphabet? AM Microsoft Office 0 28-08-2007 01:23 PM


< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT. The time now is 02:22 PM.


vBulletin, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © 2005-2016, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional