English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm trying to read in data from a file, run bubble sort on it and store the results in a file using C++...how would i do that. I understand bubble sort and I've used it before. Using it to sort to data from a file is the hard part, any help would be appreciated...

2007-10-14 17:17:15 · 3 answers · asked by Pluto 1 in Computers & Internet Programming & Design

3 answers

by using iosteam and vector headerfiles/library
, u could do very easily.. :p

just read the input file and for every value you reads,
add that to a declared variable vector
( vector is same as an array but simpler).

and when you finished reading the input file,
apply your bubble sort algo to the vector.
(you could also look on the STL for sorting, i guess it
is in the "functional.h")..

after the vector is sorted, just save it and it is done.. :p

hope that helps even though there is
no codes i've presented for you..

i did that in purpose so that it is
you who will actually code
the program for ur problem.. :)

2007-10-14 18:21:21 · answer #1 · answered by Christopher 2 · 0 0

So read all the data from the file into an array first.

2007-10-15 01:08:35 · answer #2 · answered by Kasey C 7 · 0 0

challenging aspect. research into bing and yahoo. that will can help!

2014-11-07 00:13:22 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers