Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to recognize word from sentence?

how to recognize word from sentence?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wey_horng
    wrote on last edited by
    #1

    i try to recognize by using space, but unsuccess. it might be the coding error. can someone pls show me the coding.thanks. ur reponse will be appreciated for me.

    S 1 Reply Last reply
    0
    • W wey_horng

      i try to recognize by using space, but unsuccess. it might be the coding error. can someone pls show me the coding.thanks. ur reponse will be appreciated for me.

      S Offline
      S Offline
      Shaun Wilde
      wrote on last edited by
      #2

      you will also have to use punctuation marks such as '.',',',';' etc. Hyphens are also wierd as they can indicate a joining of words or that a word has been split to allow it to wrap at the end of a line (not end of sentence), this normally happens after the 3rd charcter. eg con- tinutation

      Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku

      B 1 Reply Last reply
      0
      • S Shaun Wilde

        you will also have to use punctuation marks such as '.',',',';' etc. Hyphens are also wierd as they can indicate a joining of words or that a word has been split to allow it to wrap at the end of a line (not end of sentence), this normally happens after the 3rd charcter. eg con- tinutation

        Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku

        B Offline
        B Offline
        Bart Robeyns
        wrote on last edited by
        #3

        Splitting of words happens between two syllables. e.g.: Split-ting, not Spl-itting :)

        S 1 Reply Last reply
        0
        • B Bart Robeyns

          Splitting of words happens between two syllables. e.g.: Split-ting, not Spl-itting :)

          S Offline
          S Offline
          Shaun Wilde
          wrote on last edited by
          #4

          true - but I remember a 3 letter rule as well that you do not break the word if the first part is less than 3 letters but just start it on the next line.

          Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku

          W 1 Reply Last reply
          0
          • S Shaun Wilde

            true - but I remember a 3 letter rule as well that you do not break the word if the first part is less than 3 letters but just start it on the next line.

            Stupidity dies. The end of future offspring. Evolution wins. - A Darwin Awards Haiku

            W Offline
            W Offline
            wey_horng
            wrote on last edited by
            #5

            can i have a example full source code?

            R 1 Reply Last reply
            0
            • W wey_horng

              can i have a example full source code?

              R Offline
              R Offline
              Ryan B
              wrote on last edited by
              #6

              Somebody is not doing their homework. How do you expect to learn how to program if you dont want to do the work? I sugest switching courses. Youll get no help here. Heres some assistance though. Define "what" a word is. Is is a series of alpha characters followed by a space or possibly a form of punctuation? . , ; ' : - or is your programs definition of a word slighly simpler? can a word have numerical characters in it? is l33t a word? Ryan Baillargeon Software Specialist Fuel Cell Technologies Inc.

              W 1 Reply Last reply
              0
              • R Ryan B

                Somebody is not doing their homework. How do you expect to learn how to program if you dont want to do the work? I sugest switching courses. Youll get no help here. Heres some assistance though. Define "what" a word is. Is is a series of alpha characters followed by a space or possibly a form of punctuation? . , ; ' : - or is your programs definition of a word slighly simpler? can a word have numerical characters in it? is l33t a word? Ryan Baillargeon Software Specialist Fuel Cell Technologies Inc.

                W Offline
                W Offline
                wey_horng
                wrote on last edited by
                #7

                I think you should be misunderstanding, or else it is my fault. i suppose to post my coding and lets you all expertise and checking the error for me. However, the system now is workable for space. one more question is if i would like to get some particular word, lets say 3rd word from the sentence. then what should i add inside? the following is the coding: #include using std::cout; using std::endl; using std::cin; #include int main() { char string[256]; char *tokenPtr; cout << "Enter sentence\n"; cin.getline(string,sizeof(string),'\n'); cout << "The string to be tokenized is:\n" << string << "\n\nThe tokens are:\n"; tokenPtr = strtok( string, " " ); while ( tokenPtr != NULL ) { cout << tokenPtr << '\n'; tokenPtr = strtok( NULL, " " ); } return 0; }

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups