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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. word seperating algorithm

word seperating algorithm

Scheduled Pinned Locked Moved C / C++ / MFC
algorithms
4 Posts 2 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.
  • J Offline
    J Offline
    jonavon blakly
    wrote on last edited by
    #1

    i am a newb and i need an algorithm that can take a string of words and seperate them into seprate words.

    D 1 Reply Last reply
    0
    • J jonavon blakly

      i am a newb and i need an algorithm that can take a string of words and seperate them into seprate words.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      What are the words separated by?


      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      J 1 Reply Last reply
      0
      • D David Crow

        What are the words separated by?


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        J Offline
        J Offline
        jonavon blakly
        wrote on last edited by
        #3

        a space

        D 1 Reply Last reply
        0
        • J jonavon blakly

          a space

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          While I'm sure you'd require something a little more sophisiticated, you could start with something as simple as:

          char pSentence[] = "The time to repair the roof is when the sun is shining.",
          *pWord;

          pWord = strtok(pSentence, " ");
          while (NULL != pWord)
          {
          cout << pWord << endl;
          pWord = strtok(NULL, " ");
          }


          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          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