| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: C++ for beginners? |
From: "Paul Ranson"
ISTM that the C++ 'sort' is rather simpler to use than the C 'qsort'.
int a [ 5 ] ;
a [ 0 ] = 5 ;
a [ 0 ] = 5 ;
a [ 0 ] = 5 ;
a [ 0 ] = 5 ;
a [ 0 ] = 5 ;
wrote in message
news:v2b2q0t1vjuba0k7sfice2r91p2vtgtheu{at}4ax.com...
> On Sun, 21 Nov 2004 10:41:13 -0500, "Geo"
wrote:
>>See now this is the part that really ticks me off, we were never shown a
>>library function called qsort or even a way to find out if one exists.
>
> I was a bit nervous referring to qsort because, as Paul and Gregg have
> pointed out, a C++ programmer is supposed to use more sophisticated
> methods.
>
> In my example, the program was given an array of integers and needed
> to sort them. Calling qsort is the way to go. A more generic app would
> be dealing with classes rather than integers. In that case, you are
> supposed to add all the correct features to the class so that the
> standard template sort routine will work. An example of a "correct
> feature" would be an operator that determines whether one instance of
> a class is less than another.
>
> The reason your teacher hasn't mentioned qsort or STL sort is that
> they are REALLY weird for a beginner - you don't have time. Given an
> example, they are trivial. However, understanding them enough so you
> can use them only comes after quite a bit of C++ (or C for qsort)
> experience, IMHO.
--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)SEEN-BY: 633/267 270 5030/786 @PATH: 379/45 1 396/45 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.