Click here to Skip to main content
15,902,114 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Ellipsis / variable parameters Pin
PJ Arends29-Aug-04 8:46
professionalPJ Arends29-Aug-04 8:46 
GeneralRe: Ellipsis / variable parameters Pin
0v3rloader29-Aug-04 9:48
0v3rloader29-Aug-04 9:48 
GeneralSequentially sorting Pin
Daniel132429-Aug-04 5:46
Daniel132429-Aug-04 5:46 
GeneralRe: Sequentially sorting Pin
Maximilien29-Aug-04 6:09
Maximilien29-Aug-04 6:09 
GeneralRe: Sequentially sorting Pin
Daniel132429-Aug-04 6:26
Daniel132429-Aug-04 6:26 
GeneralRe: Sequentially sorting Pin
Maximilien29-Aug-04 6:38
Maximilien29-Aug-04 6:38 
GeneralRe: Sequentially sorting Pin
Daniel132429-Aug-04 6:43
Daniel132429-Aug-04 6:43 
GeneralRe: Sequentially sorting Pin
Ryan Binns29-Aug-04 19:24
Ryan Binns29-Aug-04 19:24 
Daniel1324 wrote:
for (int yy = 0; yy < Size; yy++)
{
for (int y = 1; y < Size; y++)
{
if (c[y] < c[y-1])
{
a = c[y-1];
b = c[y];
c[y] = a;
c[y-1] = b;
a = b = 0;
}
}
}


Size = size of int array.


Eek! | :eek: Yikes! Have a look at the qsort() C library function. You should be able to do this:
static int intCompareFunc(const void *parm1, const void *parm2)
{
  int num1 = *static_cast<const int*>(parm1);
  int num2 = *static_cast<const int*>(parm2);
  return num1 - num2;
}
...
qsort(c, sizeof(int), Size, intCompareFunc);
That should sort the c array in ascending order.

Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

GeneralUse STL Pin
Kevin McFarlane8-Oct-04 11:11
Kevin McFarlane8-Oct-04 11:11 
GeneralFinding CRLF or other Characters in char Pin
shibble29-Aug-04 4:32
shibble29-Aug-04 4:32 
GeneralRe: Finding CRLF or other Characters in char Pin
Member 30761229-Aug-04 7:09
Member 30761229-Aug-04 7:09 
GeneralRe: Finding CRLF or other Characters in char Pin
shibble29-Aug-04 7:19
shibble29-Aug-04 7:19 
GeneralIndentation+word wrapping in Edit windows Pin
DaFrawg29-Aug-04 2:26
DaFrawg29-Aug-04 2:26 
GeneralRe: Indentation+word wrapping in Edit windows Pin
Ryan Binns29-Aug-04 19:34
Ryan Binns29-Aug-04 19:34 
QuestionDetect available ODBC data sources? Pin
Roland E.29-Aug-04 0:09
Roland E.29-Aug-04 0:09 
AnswerRe: Detect available ODBC data sources? Pin
JimmyRopes29-Aug-04 5:04
professionalJimmyRopes29-Aug-04 5:04 
Question"Small" bug in CSimpleArray ??? Pin
Ernesto D.28-Aug-04 22:47
Ernesto D.28-Aug-04 22:47 
AnswerRe: &quot;Small&quot; bug in CSimpleArray ??? Pin
Neville Franks28-Aug-04 23:54
Neville Franks28-Aug-04 23:54 
GeneralRe: &quot;Small&quot; bug in CSimpleArray ??? Pin
Ernesto D.29-Aug-04 9:47
Ernesto D.29-Aug-04 9:47 
GeneralRe: &quot;Small&quot; bug in CSimpleArray ??? Pin
Neville Franks29-Aug-04 10:56
Neville Franks29-Aug-04 10:56 
GeneralRe: &quot;Small&quot; bug in CSimpleArray ??? Pin
Ernesto D.30-Aug-04 22:02
Ernesto D.30-Aug-04 22:02 
AnswerReal world example (try it if you wish) Pin
Ernesto D.29-Aug-04 9:38
Ernesto D.29-Aug-04 9:38 
GeneralRe: Real world example (try it if you wish) Pin
Neville Franks31-Aug-04 10:09
Neville Franks31-Aug-04 10:09 
GeneralRe: Real world example (try it if you wish) Pin
Ernesto D.1-Sep-04 13:19
Ernesto D.1-Sep-04 13:19 
GeneralISAPI Filter wont load when i add OnSendRawData notification Pin
raed28-Aug-04 22:26
raed28-Aug-04 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.