The library optimezedr should determine if a collection of books is in ascending or desending order.Your solution must read books from a text file and produce 2 additional text files one in ascending order and one in Descending order. then your solution will indicate if your original text file in in ascending or descending order or not sorted .You can only use the following c++ libraries:iostrem,fstream and string. Could someone please help me with this thank you.

Recommended Answers

All 2 Replies

Perhaps if you tell us where you are stuck we can offer some suggestions. What have you done so far?

commented: nothing don't know how to was hoping someone would help with the whole code +0

Let me suggest a dumb solution. Read from the original list. For each row or record, compare the title, name or whatever, to that of the previous record. If Current > Previous then increment a counter I'll call Ascending else increment a counter I'll call Descending. When your done, if the value of either Ascending or Descending is very high, that tells you the order of the original list. If both counters are fairly high, the original list is not sorted. There are probably much more elegant ways to do this, so I'll call this a quick and dirty solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.