Search:

Type: Posts; User: eugene3204

Search: Search took 0.07 seconds.

  1. [SOLVED] Re: Find the longest word in string - code has bugs

    Yes a while loop fixes the problem! Thank you so much Norm!
  2. [SOLVED] Re: Find the longest word in string - code has bugs

    I found the problem now. This is the output of i and st.length()
    i: 0
    st.length(): 168
    =================
    i: 1
    st.length(): 160
    =================
    i: 2
    st.length(): 151
    =================
  3. [SOLVED] Re: Find the longest word in string - code has bugs

    This is my revised code:


    public static void charNum(String st) {
    // define variables
    String first_word;
    int word_length;
    String longest_word = "";
    int temp_wordcount = 0;...
  4. [SOLVED] Re: Find the longest word in string - code has bugs

    This is just the input sentence for the code to find the longest word. The meaning of it does not matter, which you can replace it with any other sentences. This is a sentence I copied from the...
  5. [SOLVED] Re: Find the longest word in string - code has bugs

    Hi Norm,
    Thank you for your reply. I have added the comments below and hope it makes it more clear.
    The expected output from the code is to display the longest word in sentence. The problem is that...
  6. [SOLVED] Find the longest word in string - code has bugs

    I am writing the following code to display the longest word in a sentence and there are bugs which I have no idea how to solve this. Please help me.

    Input st = aaaa bbbb ccccc ddd eee ffff aaaa...
Results 1 to 6 of 6