Created
January 21, 2015 21:50
-
-
Save nohe427/2d82ddfa9793822d8af2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Button1Click(object sender, EventArgs e) | |
{ | |
string name; | |
name = textBox1.Text; | |
string pigName = ""; | |
makePigLatin(ref pigName, name); | |
label1.Text = pigName; | |
} | |
public void makePigLatin(ref string pigName, string name) | |
{ | |
string vowels = "AEIOUaeiou"; | |
string firstLetter; | |
string restOfWord; | |
int letterPos; | |
firstLetter = name.Substring(0, 1); | |
restOfWord = name.Substring(1, name.Length - 1); | |
letterPos = vowels.IndexOf(firstLetter); | |
if (letterPos == -1) | |
pigName = restOfWord + firstLetter + "ay"; | |
else | |
pigName = name + "way"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment