How can I sort char line according to alphabet order.I have a problem with in below code with it . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How can I sort char line according to alphabet order.I have a problem with in below code with it .

https://code.sololearn.com/c8Fi3pVgBG8W/?ref=app

19th Apr 2018, 7:55 AM
Abdusamad
Abdusamad - avatar
6 Answers
+ 1
I've utilised the built-in list functionality of C++. This still isn't perfect code, but it's a step in the right direction for you: https://code.sololearn.com/c7kUSj82qCIn/#cpp
20th Apr 2018, 12:05 AM
Emma
+ 2
Hi This is an improved version: https://code.sololearn.com/cpVyM8aCxbuK/#cpp It avoids loading all the books from the file into memory first, which is better. It keeps books that match the publishing year we are searching by, as we are loading the book data from the file; in this way, we are only storing the books that match our search criteria in memory.
20th Apr 2018, 10:18 AM
Emma
+ 1
That doesn't happen with my version of the code... strange. My Booksinfo.txt file is as follows: 025365 Jack_London Blue_Sky 1956 British_publishing 220 010000 Jim_Toad Red_Sky 1956 Scotish_publishing 108 020000 Shirley_Bat Orange_Sky 1956 Welsh_publishing 305 030000 Susan_Bread Yellow_Sky 1956 Irish_publishing 420 040000 David_Sauce Green_Sky 1956 English_publishing 194
20th Apr 2018, 4:40 PM
Emma
+ 1
The variable num_books_found should contain the number of books found in any search. This works for me in both versions of the code. Can you be more specific? Thanks :-)
20th Apr 2018, 4:43 PM
Emma
0
Thank you Xan ,it worked very well,There is not mistake in your code .It is Ok,but the only thing ,when I run the code ,it is repeating num_books _found number,It is not problem Thanks a lot
20th Apr 2018, 12:48 PM
Abdusamad
Abdusamad - avatar
0
Ok,Xan,I am a new learner,so I don't know what exactly suitable for run the code.What do you recommend me?Which software can run the code more specific ,Dev Or Code Blocks ,Borlandc++,.One thing again I started programming with c++,I don't have exception about other languages ,it means I cant understand other Lang code.
20th Apr 2018, 6:02 PM
Abdusamad
Abdusamad - avatar