sorting words that

Posted on 2005-04-13
Last Modified: 2010-04-17
Using VC++ 6. I read text from a text file which contain words seperated by spaces. Now i have to sort these words in accending order using bubb;e sort and search a word from it. But i use single dimentional array for display text from file. can anybody solve it to sort the words not the characters.
Question by:spydev
    1 Comment
    LVL 23

    Accepted Solution

    You will have to tokenize the text using something like strtok()  (or, preferably strtok_r()).
    Store the tokenized words in an array of pointers to strings.  Sort that array using strcmp()
    as the compare function.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    This is about my first experience with programming Arduino.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now