Resource Database Program - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Projects (http://qbasicnews.com/newforum/forum-12.html) +--- Thread: Resource Database Program (/thread-10105.html) |
Resource Database Program - LPG - 04-17-2008 For school my friend and I have been writing a database program to keep track of where the Year 7-8 resources are (500 textbooks). it is in JustBASIC ( a windows version of QB , google it ) and it is almost finished but i want to organise from A-Z. what would be the fastest code to do that assuming the list is in an array? Re: Resource Database Program - Tia - 04-18-2008 You want to use a shell or bubble sort. A shell sort will be faster but a bubble sort is easier to code. I in all honesty forget how to do them but you can easily figure out how to do them. Basically A bubble sort works like this. words: Cat, Dog, Apple, Justice, Health, Gatorade It will compare Cat and Dog first Cat vs. Dog no change cat starts with a c and c comes before d Cat, Dog, Apple, Justice, Health, Gatorade next dog vs. apple change a comes before d Cat, Apple, Dog, Justice, Health, Gatorade next dog vs. justice no change d comes before j Cat, Apple, Dog, Justice, Health, Gatorade next justice vs. health change h comes before j Cat, Apple, Dog, Health, justice, Gatorade next justice vs gatorade change g comes before j Cat, Apple, Dog, Health, Gatorade, justice And so on until the order no longer has any changes. It will go through the list more than once (assuming nothing is in correct order) I forget the logic on shell sort but it has something to do with splitting everything in half. http://en.wikipedia.org/wiki/Bubble_sort http://en.wikipedia.org/wiki/Shell_sort Sorry about forgetting the algorithms to these but I haven't used QB in almost 4 months now but I hope this helps you to get started. Re: Resource Database Program - LPG - 04-18-2008 thanks. I think i will use shell sort as it already takes 30 seconds to load and then teachers will probably get impatient. Re: Resource Database Program - Tia - 04-19-2008 Glad I can get you started. If I still had my QB book I'd post what basic shell sort code looks like but I don't. You should be able to find more resources on the web as well. Re: Resource Database Program - zoasterboy - 04-22-2008 Quote:( a windows version of QB , google it ) A quick note ;D JB isnt a Windows version of QB, JB is it's own dialect of BASIC just like QB is its own dialect of BASIC. All versions of BASIC have evolved over time based on the original BASIC developed by John Kemeny and Thomas Kurtz at Dartmouth College. Although the JB developers may have been influenced by QB, JB and QB are still considered different languages (under the same general scope of "BASIC" languages.) Re: Resource Database Program - Dav - 04-23-2008 Well, here's one way (mentioned above). It uses the QB command SWAP to put names in alphabetical order. I don't *think* JB has a SWAP command, but could be wrong since It' been a while since I actually made somethiing with JB. (I was a beta tester for it, that was a while ago). The QB way... Quote:NumberOfEntries = 4 'how many names to sort There's an article or two about sorting on the justbasic forum. Wait...here's a link... http://justbasic.conforums.com/index.cgi?board=tutorial&action=display&num=1120928790 - Dav Re: Resource Database Program - LPG - 04-27-2008 (04-22-2008, 10:22 PM)zoasterboy link Wrote:Sorry I meant it acts similarly to QBQuote:( a windows version of QB , google it ) LPG |