Click here to Skip to main content
15,889,462 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sort Functions Pin
CPallini23-Nov-10 10:06
mveCPallini23-Nov-10 10:06 
GeneralRe: Sort Functions Pin
S Houghtelin24-Nov-10 4:07
professionalS Houghtelin24-Nov-10 4:07 
AnswerUse QuickSort Pin
DarthDana24-Nov-10 4:20
professionalDarthDana24-Nov-10 4:20 
GeneralRe: Use QuickSort Pin
Maximilien24-Nov-10 5:42
Maximilien24-Nov-10 5:42 
GeneralRe: Use QuickSort Pin
Matthew Barnett24-Nov-10 5:46
Matthew Barnett24-Nov-10 5:46 
GeneralRe: Use QuickSort Pin
«_Superman_»24-Nov-10 7:30
professional«_Superman_»24-Nov-10 7:30 
GeneralRe: Use QuickSort Pin
ThatsAlok11-Jul-11 21:18
ThatsAlok11-Jul-11 21:18 
AnswerRe: Sort Functions Pin
James Lonero24-Nov-10 9:00
James Lonero24-Nov-10 9:00 
Interesting sort functions. The first function can be associated to a "bubble sort" except nothing is "bubbling up" in the list array. The inner loop is only storing the index of the smallest value. Then at the end of the second loop (bottom of the first loop), the values are swapped. This is more efficient than a bubble sort because we are not swapping the items in the array (excessive memory access) every time we determine that (list[j] < list[min]). The swap is done n times rather than (n * n) times.

The second sort is sorting an array of indexes based on the percentage change. The original list array is untouched. It is used only for reference. The final result is the indexByGain array. This should be returned. But, it is not and so is lost. For the reporting, the programmer would need to run through the indexByGain to print out the report as:

for (int k = 0; k < length; k++)
printf("%f\n", list[indexByGain[k]].getPercentChange());

assuming that getPercentChange() returns a double or float. Sorry, my C coding is a bit rusty.
AnswerRe: Sort Functions Pin
dpminusa24-Nov-10 13:32
dpminusa24-Nov-10 13:32 
AnswerRe: Sort Functions Pin
James Curran28-Nov-10 5:18
James Curran28-Nov-10 5:18 
QuestionCButton question Pin
DerrekCurtis23-Nov-10 7:09
DerrekCurtis23-Nov-10 7:09 
AnswerRe: CButton question Pin
«_Superman_»23-Nov-10 7:19
professional«_Superman_»23-Nov-10 7:19 
AnswerRe: CButton question Pin
Member 399486624-Nov-10 3:13
Member 399486624-Nov-10 3:13 
QuestionDebugging multiple processes within a visual studio solution Pin
aevanscambs23-Nov-10 6:00
aevanscambs23-Nov-10 6:00 
AnswerRe: Debugging multiple processes within a visual studio solution Pin
Eugen Podsypalnikov23-Nov-10 6:02
Eugen Podsypalnikov23-Nov-10 6:02 
AnswerRe: Debugging multiple processes within a visual studio solution Pin
«_Superman_»23-Nov-10 7:16
professional«_Superman_»23-Nov-10 7:16 
QuestionListing DLL Exports Pin
softwaremonkey23-Nov-10 5:23
softwaremonkey23-Nov-10 5:23 
AnswerRe: Listing DLL Exports PinPopular
Eugen Podsypalnikov23-Nov-10 5:54
Eugen Podsypalnikov23-Nov-10 5:54 
GeneralRe: Listing DLL Exports Pin
softwaremonkey23-Nov-10 6:09
softwaremonkey23-Nov-10 6:09 
AnswerRe: Listing DLL Exports Pin
«_Superman_»23-Nov-10 7:21
professional«_Superman_»23-Nov-10 7:21 
AnswerRe: Listing DLL Exports Pin
Luc Pattyn23-Nov-10 8:23
sitebuilderLuc Pattyn23-Nov-10 8:23 
QuestionPutting CMFCToolBar in CFormView problem Pin
Harsh Shankar23-Nov-10 1:13
Harsh Shankar23-Nov-10 1:13 
AnswerRe: Putting CMFCToolBar in CFormView problem Pin
Eugen Podsypalnikov23-Nov-10 5:45
Eugen Podsypalnikov23-Nov-10 5:45 
QuestionRe: Putting CMFCToolBar in CFormView problem Pin
Harsh Shankar24-Nov-10 2:54
Harsh Shankar24-Nov-10 2:54 
AnswerRe: Putting CMFCToolBar in CFormView problem Pin
Eugen Podsypalnikov24-Nov-10 21:42
Eugen Podsypalnikov24-Nov-10 21:42 

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.