2 Replies - 1197 Views - Last Post: 28 November 2011 - 02:57 PM Rate Topic: -----

#1 Jenny123  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 26-November 11

Can anyone please help with english to pig latin

Posted 28 November 2011 - 02:49 PM

hi

ive been stuck at this program for a few days and i cant get any help from my school notes, can any help me out or give me a few tips to make this code work for translating english into pig latin in miscrosoft visual studio.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace week8_Pig_Latin_Translator_form
{
    public partial class PigLatinTranslatorForm : Form
    {
        public PigLatinTranslatorForm()
        {
            InitializeComponent();
        }

        private void btnTranslate_Click(object sender, EventArgs e)
        {
            {
                List<string> words = new List<string>();
                string english = Convert.ToString(txtEnglish.Text);

                words.Add(english);


                string pigLatin = "";
                string firstLetter;
                string restOfWord;
                string vowels = "AEIOUaeiou";
                int letterPos;



                string[] Words = txtEnglish.Text.Split(' ');


                foreach (string word in english.Split())
                {
                    firstLetter = word.Substring(0, 1);
                    restOfWord = word.Substring(1, word.Length - 1);
                    letterPos = vowels.IndexOf(firstLetter);
                    if (letterPos == -1)  
                    {

                        pigLatin = restOfWord + firstLetter + "ay";
                    }
                    else 
                    {

                        pigLatin = word + "way";
                    }
                    txtpigLatin.Text = txtpigLatin.ToString();

                    txtEnglish.Focus();

                 
                }
            }

        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            txtEnglish.Clear();
            txtpigLatin.Clear();
            txtEnglish.Text = "";
            txtpigLatin.Text = "";
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}




many thanks if you can help me

Is This A Good Question/Topic? 0
  • +

Replies To: Can anyone please help with english to pig latin

#2 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4498
  • View blog
  • Posts: 7,850
  • Joined: 08-June 10

Re: Can anyone please help with english to pig latin

Posted 28 November 2011 - 02:55 PM

Quote

can any help me out or give me a few tips to make this code work


Sorry, that's not how it works here. You don't just dump code on us and say "it's not working!"

You tell us about any errors (line numbers, exact error texts, etc...), or you explain desired behavior vs. actual behavior. And you explain what you've tried to do to fix it yourself.

Or you can ask a specific question, not a "can you help" kind of question. Then we help all we can.

Otherwise, it'd just be us doing your homework for you, and we don't do that.
Was This Post Helpful? 1
  • +
  • -

#3 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5537
  • View blog
  • Posts: 11,866
  • Joined: 02-June 10

Re: Can anyone please help with english to pig latin

Posted 28 November 2011 - 02:57 PM

Reminder to all: This is course homework. We do NOT provided completed code for homework. We can help the OP understand specific concepts they are having trouble with or specific errors they don't understand.

Of course they have to tell us the specific errors first, and not just "Can you help me with my homework, its due soon."

The stages of asking for homework help on a forum


tlhIn`toq said:

The three different kinds of rookie posters on DIC.

Spoiler

This post has been edited by tlhIn`toq: 28 November 2011 - 03:12 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1