I've been writing a pig latin translation program for a week in class now and i've gotten so far but now i don't know what to do.

i need to check if the word has a vowel as the first letter then only add ay in the end
if it has an "ay" sound ending i.e. has ay,ey,ai,ei at the end, then the word remains unchanged
i need to check if the word has one or more consonants in the beginning of it. if it does, the consonant need to go back of the word and then an "ay" needs to be added.

and i need to be able to do sentences. pls do not use advanced functions or new terms that i may not understand as i am still a student. my teacher told me to use the while loop and that finding the length of the string may help in some way.

here's the code i've done soo far.

#include <iostream>
#include <string>

using namespace std;

const string strVOWELS = "aeiouAEIOU";
const string strCONSONANTS = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ";
const string strAYLIKEENDINGS = "ay","ei","ai","ey";

bool isAVowel(char);
bool isAConsonant(char);
bool hasAnAYLikeEnding(char);
void translateEnglishToLatin(string);

string strEnglish;
string strLatin;

int main()
	cout << "Please enter stuff to be translated : ";
	cout << endl << "~~~~~~Translation~~~~~~" << endl << endl << strLatin << endl << endl;

	return 0;

bool isAVowel(char ch)
	return strVOWELS.find(ch) != string::npos;

bool isAConsonant(char ch)
	return strCONSONANTS.find(ch) != string::npos;

bool hasAnAYLikeEnding(char ch)
	return strAYLIKEENDINGS.find(ch) !=string::npos;

void translateEnglishToLatin (string strEnglish)
		if(hasAnAYLikeEnding(strEnglish[-2 && -1]))
			strLatin = strEnglish;

			strLatin = strEnglish + "ay";
		if(isAConsonant(strEnglish[0]) && isAVowel (strEnglish[1]))
			strLatin = strEnglish.substr(1,strEnglish.length()-1) + strEnglish[0] + "ay";


		int i1stVowel = 1;
		while(! isAVowel(strEnglish[i1stVowel]))


I'll make you a deal... you translate and repost your request for help into pig latin.. and I'll throw some quality c++ code your way.

commented: LOL :L +3

If you need help, you need to explain what you need help with. All you've said is "Here's what I need to do, Here's my code." No mention of what the trouble is.

i want to know how to fix the bloody thing
how to check for ay,ai,ey,ei ending, and how to translate whole sentences ..

and also how the damn while loop thingy works .. kapish?

I'm still not giving out code until you post in pig latin. In fact, I propose that for the rest of this thread, everyone post in pig latin.

easeplay elphay ithway ymay ogrampray!

Who made your rules? I ask because they are not the standard translation rules.

1) All consonants at the beginning of the word are moved to the end and AY is added.
2) If the word begins with a vowel, WAY is added with no other changes.
3) There is no rule about the end of the word ending in the AY sound. This is a nearly impossible rule to test for. A computer program cannot test for a sound.

See this.

>A computer program cannot test for a sound.
I'm sure all of the programmers working on phonetic recognition algorithms (eg. Soundex) will be dismayed to hear that.

I'm sure they will. Sorry guys...

Iway agreeway ithway altPWay aboutway oundsay etectionday ithinway hetay copesay ofway ouryay sc100cay lasscay. Inway orderway otay akemay ouryay instructorway appyhay houghtay, e'llway avehay otay roceedpay underway hetay assumptionway hattay anyway ordway endingway inway "ay" illway esultray inway anway "ay" oundsay. ithWay histay inway indmay, Iway resentpay otay e'yay hetay ollwingfay odecay:

bool is_ay(string& word)
     int pos = word.rfind("ay");
     return (pos == word.size()- 2);

ownay ouya ancay esttay ordsway orfay hetay "ay" oundsay, if(is_ay(word)) hentay eavelay itway aloneway.

commented: Next stop, a compiler that understands PL! +5

i just need to check if the words end with ay,ey,ei,ai .. look .. this is what's assigned to me .. i need to do it .. if i argue with my programming teacher he'll just temme to drop the course or don't do the assignment and fail it .. i don't care about way or ay .. need some help understanding how to do it...if you could help, it would be highly appreciated ..
i made another program which i'll post soon but if you correct this and temme how to translate whole sentences it'll b awesome .. coz i need to translate a part of hamlet next ..

implysay odifymay ymay originalway odecay otay eetmay ouryay eedsnay:

is_ay(stirng& word)
     int pos = 0;
     string test[4] = {"ay", "ey", "ei", "ai"};     

     for(int i=0; i<4; i++)
          if(word.rfind(test[i] == word.size() - 2))
               return true;

     return false;

Then look at the last characters of each word and compare them with your list of AY sounds.

cool beans guys!
now the toughest thing i need to do.