How would I write this?
I am new to C++ and am trying to write this but don't really have any idea how?

I tried to outline it first so I could do it step by step, but now that I have outlined it I am stuck one how to do it?

This is my outline.

int main( )
{ 
	declare el, pl as strings to store an English line, Pig Latin line;

	prompt for and get English line (use gets);
	while (line is not equal to “!!!”)
   	{  
		translate(el, pl);
      		output Pig Latin line to the screen and to a file;
      		prompt for and get English line (use getline);
	}
   
	system("pause");
	return 0;
}

void translate(const char el[ ], char pl[ ])
{ 
	declare ew, pw as c-strings to store an English, Pig Latin word;
   	declare ep, pp as integer variables that tell the current positions in el, pl;

	initialize current positions ep, pp to be the beginning of el, pl, i.e. initialize them to 0;
   	while (not at end of el)
      	if (character at current position in el is a letter)
      	{
		extract word from el that starts from current position and store in ew;
          	translate word ew to Pig Latin and store in pw;
          	copy pw at current end of pl;
          	make sure ep, pp are now set to positions just past the word;
      	}
      	else
      	{
          	copy character unchanged to current position in pl;
          	increment ep, pp;
      	}
   
	Null terminate the string pl;
}

can someone walk me through how I would do each of these steps ... or maybe just some of them piece by piece so I can understand how to do it.

Do you want to create a program which takes in an english string and then outputs the same string in another language?

That can't be computed by C++, you would have to create a database of english word -> latin word.

Well I need to translate a sentence from English to Piglatin.

My instructor wrote some guide lines and I tried creating an outline of what I needed to do to fit the guidelines.

Guidelines:
1.If the word starts with a vowel ('a', 'e', 'i', 'o', 'u', or 'A, 'E', 'I', 'O', 'U') or does not contain a vowel, its Pig Latin equivalent is formed by just adding the suffix “way”.
2.If the word starts with a consonant (any letter that is not a vowel) and contains a vowel its Pig Latin equivalent is formed by moving the initial consonant string (that is all letters up to the first vowel) from the beginning of the word to the end and then adding the suffix “ay”.
3.If a word is transformed by rule 2) and starts with an upper case character (consonant), its Pig Latin equivalent also starts with an upper case character (vowel) and the consonant is changed to lower case.

Do you want to create a program which takes in an english string and then outputs the same string in another language?

That can't be computed by C++, you would have to create a database of english word -> latin word.

Create a function that you pass an array of chars, then do your manipulation from there. First an if statement that checks if element[0] is == to vowel. Then go from there.

This article has been dead for over six months. Start a new discussion instead.