Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Bubble sort help!

Author
Message
Geoff123
16
Years of Service
User Offline
Joined: 22nd Dec 2007
Location:
Posted: 23rd Dec 2007 10:51
Hi im new to the forum and i need some help. Basically i want advise on how i would take words from an array and use bubble sort to display them alphabetically, preferably numbered. I can bubblesort numbers, but not letters, any help would be greatly appreciated.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Dec 2007 13:33
Words are sorted exactly like numbers. You can use > (greater than) and < (less than) in exactly the same way. It uses the ascii value of the character to sort them (http://www.asciitable.com)
Geoff123
16
Years of Service
User Offline
Joined: 22nd Dec 2007
Location:
Posted: 23rd Dec 2007 17:32 Edited at: 23rd Dec 2007 23:06
Geoff123
16
Years of Service
User Offline
Joined: 22nd Dec 2007
Location:
Posted: 23rd Dec 2007 17:43
Cheers for the reply thats great. 1 more thing, if i have the following code DIM cities(6) AS STRING DIM population(6) AS STRING Then a list of 6 cities with populations in a DATA statement eg: "LONDON", 250,000 etc., followed by a FOR and READ loop, how would i allow for a user to input 2 numbers in the cities listed and then display the combined population of both? Again any heal is massively appreciated. I am a beginner to programming but i am really interested in it to see how i do. I do own the book (vol 1) by Alistair Stewart but i am struggling a bit getting to grips with arrays. Thanks again.

Login to post a reply

Server time is: 2024-09-27 08:31:30
Your offset time is: 2024-09-27 08:31:30