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.

Program Announcements / number sorting algorithm (header file)

Author
Message
LOLdaniel
9
Years of Service
User Offline
Joined: 19th Nov 2009
Location: LOLEVERYWHERE
Posted: 10th Apr 2010 09:14
Hi, well this wasn't written in dark basic or darkGDK, but i thought this header file i made might be useful for certain things any of you might want to do.

This is basically a header file that contains an insertion sort algorithm which will sort any amount of numbers you want from smallest to greatest. All you have to do is include the header file at the top of you file, along with the C iostream file, and just call the function. There's a simple how to file and example file in the download.

Here's an example of how it'll work:


Attachments

Login to view attachments
Hassan
10
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 10th Apr 2010 16:00
no offense but this is the one of the simplest programs a programmer can write..

C0wbox
13
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 10th Apr 2010 17:42 Edited at: 10th Apr 2010 17:48
Yeh, Hassan's right. We did this in computing 1st year as a quick exercise, it's nothing special.

Jeff032
12
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 10th Apr 2010 19:11
There is a faster, built-in function defined in the <algorithm> header. (and it works for types other than int)

It can be used like this (and many other ways):

int i[] = {8, 4, 2, 7, 2};
sort(i, i + 5);

http://cplusplus.com/reference/algorithm/sort/

Login to post a reply

Server time is: 2019-08-17 13:51:28
Your offset time is: 2019-08-17 13:51:28