Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sorting words that

Posted on 2005-04-13
3
Medium Priority
?
241 Views
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.
0
Comment
Question by:spydev
1 Comment
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 500 total points
ID: 13778599
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.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Six Sigma Control Plans

810 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