Hey,
I'm having a lot of problems programming a english to pig latin program. I am using Visual Studio.NET. The program criteria is as follows:
1) Create a program that converts english to pig latin that inputed via a text box.
2) If the word starts with a vowel leave the word alone and append "WAY" at the end. eg: APPLE = APPLEWAY
3) If the word starts with a consonant take the first letter and move to the back and append "AY" eg: CAT = ATCAY
4) Display the Results via a message box
I think I got some of code correct, but I am confused how to append WAY and AY. Here is the code that I have finished. I'm not trying to be lazy or anything, but could anyone please help me out with this? Thanks.
Private Sub cmdConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConvert.Click
Dim intX As Integer
Dim intY As Integer
Dim intLength As Integer
Dim intCount As Integer
Dim intWordCount As Integer
Dim strInput As String = txtEnglish.Text
Dim strOutput As String
Dim strTemp As String
intLength = txtEnglish.Text.Length()
If txtEnglish.Text = "" Then
MessageBox.Show("Please enter text.", "Input Error")
txtEnglish.Focus()
End If
intY = 0
For intX = 0 To intLength - 1
If txtEnglish.Text.Substring(intX, 1) = " " Then
intWordCount += 1
strOutput &= txtEnglish.Text.Substring(intX, 1)
Else
If txtEnglish.Text.Substring(intX, 1) = "A" Or _
txtEnglish.Text.Substring(intX, 1) = "E" Or _
txtEnglish.Text.Substring(intX, 1) = "I" Or _
txtEnglish.Text.Substring(intX, 1) = "O" Or _
txtEnglish.Text.Substring(intX, 1) = "U" Then
intCount += 1
Else
strTemp = txtEnglish.Text.Substring(intX, 1)
intX += 1
End If
strOutput &= txtEnglish.Text.Substring(intX, 1)
intY += 1
End If
Next
End Sub
Thanks!
I'm having a lot of problems programming a english to pig latin program. I am using Visual Studio.NET. The program criteria is as follows:
1) Create a program that converts english to pig latin that inputed via a text box.
2) If the word starts with a vowel leave the word alone and append "WAY" at the end. eg: APPLE = APPLEWAY
3) If the word starts with a consonant take the first letter and move to the back and append "AY" eg: CAT = ATCAY
4) Display the Results via a message box
I think I got some of code correct, but I am confused how to append WAY and AY. Here is the code that I have finished. I'm not trying to be lazy or anything, but could anyone please help me out with this? Thanks.
Private Sub cmdConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConvert.Click
Dim intX As Integer
Dim intY As Integer
Dim intLength As Integer
Dim intCount As Integer
Dim intWordCount As Integer
Dim strInput As String = txtEnglish.Text
Dim strOutput As String
Dim strTemp As String
intLength = txtEnglish.Text.Length()
If txtEnglish.Text = "" Then
MessageBox.Show("Please enter text.", "Input Error")
txtEnglish.Focus()
End If
intY = 0
For intX = 0 To intLength - 1
If txtEnglish.Text.Substring(intX, 1) = " " Then
intWordCount += 1
strOutput &= txtEnglish.Text.Substring(intX, 1)
Else
If txtEnglish.Text.Substring(intX, 1) = "A" Or _
txtEnglish.Text.Substring(intX, 1) = "E" Or _
txtEnglish.Text.Substring(intX, 1) = "I" Or _
txtEnglish.Text.Substring(intX, 1) = "O" Or _
txtEnglish.Text.Substring(intX, 1) = "U" Then
intCount += 1
Else
strTemp = txtEnglish.Text.Substring(intX, 1)
intX += 1
End If
strOutput &= txtEnglish.Text.Substring(intX, 1)
intY += 1
End If
Next
End Sub
Thanks!