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

C / C++ / MFC

 
QuestionProblems with OnNcCreate() Pin
mspb18-Jan-10 22:14
mspb18-Jan-10 22:14 
AnswerRe: Problems with OnNcCreate() Pin
KingsGambit18-Jan-10 23:39
KingsGambit18-Jan-10 23:39 
AnswerRe: Problems with OnNcCreate() Pin
mspb19-Jan-10 1:13
mspb19-Jan-10 1:13 
AnswerRe: Problems with OnNcCreate() Pin
Damir Valiulin20-Jan-10 18:46
Damir Valiulin20-Jan-10 18:46 
QuestionArranging desktop items Pin
Anu_Bala18-Jan-10 21:46
Anu_Bala18-Jan-10 21:46 
AnswerRe: Arranging desktop items Pin
Code-o-mat18-Jan-10 22:13
Code-o-mat18-Jan-10 22:13 
AnswerRe: Arranging desktop items Pin
Rolf Kristensen19-Jan-10 12:08
Rolf Kristensen19-Jan-10 12:08 
Questionเเปลง code นี้เป็นภาษษซีให้น่อยครับ Pin
beersaw18-Jan-10 20:41
beersaw18-Jan-10 20:41 
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace GenericMergeSort
{
class MergeSort
{
/// <summary>
/// Sorts an array of Objects
/// IComparable - use 'CompareTo' to compare objects
/// where T : new() - need to create a new Type 'T' object inside the method
/// </summary>
/// <param name="X"></param>
public static T[] Merge_Sort<T>(T[] X) where T : IComparable, new()
{
int n = X.Length;
X = MegrgeSort_Internal(X, n);
return X;
}

/// <summary>
/// Internal method for sorting
/// </summary>
/// <param name="X"></param>
/// <param name="n"></param>
private static T[] MegrgeSort_Internal<T>(T[] X, int n) where T : IComparable, new()
{
// Define 2 aid Sub-Arrays
T[] A = new T[(n / 2) + 2];
T[] B = new T[(n / 2) + 2];

// Initialize the 2 Sub-Arrays with an infinite 'sorting parameter'
// Therefor, You must include a default ctor in your class
// which will initialize an infinite value - To the sorting parameter
// using 'where T : new()' here
for (int i = 0; i < A.Length; i++)
{
A[i] = new T(); ;
B[i] = new T();
}

// Recursive Stop-Condition, Sorting a Basic Array (Size 2)
if (n == 2)
{
int CompareValue = X[0].CompareTo(X[1]);
if (CompareValue > 0)
{
T tempT = X[0];
X[0] = X[1];
X[1] = tempT;
}
}

else
{
// The Sub-Arrays Size is Large than 2
if (n > 2)
{
int m = n / 2;

// Initialize the 2 Sub-Arrays (The first relevant values)
for (int i = 0; i < m; i = i + 1)
{
A[i] = X[i];
}

for (int j = m; j < n; j++)
{
B[j - m] = X[j];
}

// 2 Recursive Calling, Sorting Sub-Arrays
A = MegrgeSort_Internal(A, m);
B = MegrgeSort_Internal(B, n - m);

// Merging the Sorted Sub-Arrays into the main Array
int p = 0;
int q = 0;

for (int k = 0; k < n; k++)
{
{
int CompareValure = A[p].CompareTo(B[q]);

if (CompareValure == 0 ||
CompareValure == -1)
{
X[k] = A[p];
p = p + 1;
}

else
{
X[k] = B[q];
q = q + 1;
}
}
}

} // if

} // else

return X;

} // MegrgeSort_Internal
}
}
AnswerPlease read posting guidelines Pin
CPallini18-Jan-10 20:47
mveCPallini18-Jan-10 20:47 
AnswerRe: เเปลง code นี้เป็นภาษษซีให้น่อยครับ Pin
Sauce!18-Jan-10 20:47
Sauce!18-Jan-10 20:47 
AnswerRe: เเปลง code นี้เป็นภาษษซีให้น่อยครับ Pin
Adam Roderick J18-Jan-10 20:56
Adam Roderick J18-Jan-10 20:56 
QuestionLimit Maximizing window Pin
Anu_Bala18-Jan-10 17:37
Anu_Bala18-Jan-10 17:37 
AnswerRe: Limit Maximizing window Pin
Adam Roderick J18-Jan-10 18:04
Adam Roderick J18-Jan-10 18:04 
GeneralRe: Limit Maximizing window Pin
Anu_Bala18-Jan-10 23:17
Anu_Bala18-Jan-10 23:17 
Questionhook windows messages Pin
Sauce!18-Jan-10 16:58
Sauce!18-Jan-10 16:58 
AnswerRe: hook windows messages Pin
Covean18-Jan-10 21:21
Covean18-Jan-10 21:21 
GeneralRe: hook windows messages Pin
Sauce!18-Jan-10 22:57
Sauce!18-Jan-10 22:57 
QuestionMFC How to update CMDIChildWnd from CDocument Pin
baumchen18-Jan-10 14:20
baumchen18-Jan-10 14:20 
AnswerRe: MFC How to update CMDIChildWnd from CDocument Pin
Adam Roderick J18-Jan-10 17:00
Adam Roderick J18-Jan-10 17:00 
GeneralRe: MFC How to update CMDIChildWnd from CDocument Pin
baumchen18-Jan-10 17:27
baumchen18-Jan-10 17:27 
QuestionRe: MFC How to update CMDIChildWnd from CDocument [modified] Pin
Adam Roderick J18-Jan-10 17:32
Adam Roderick J18-Jan-10 17:32 
AnswerRe: MFC How to update CMDIChildWnd from CDocument Pin
baumchen18-Jan-10 18:01
baumchen18-Jan-10 18:01 
GeneralRe: MFC How to update CMDIChildWnd from CDocument Pin
Adam Roderick J18-Jan-10 18:22
Adam Roderick J18-Jan-10 18:22 
GeneralRe: MFC How to update CMDIChildWnd from CDocument Pin
baumchen18-Jan-10 18:29
baumchen18-Jan-10 18:29 
GeneralRe: MFC How to update CMDIChildWnd from CDocument Pin
Adam Roderick J18-Jan-10 18:56
Adam Roderick J18-Jan-10 18:56 

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.