// ================================================ ================
// Understanding of the const type
Class B
{
Public:
Int B;
};
Class
{
Public:
B * pb;
Int * PI;
A (): Pb (New B (), Pi (New int ())
{
}
};
Int _ tmain (INT argc, _ tchar * argv [])
{
Const A * pA = new ();
// Pa-> Pb = new B ();
// Pa-> Pi = new int ();
Pa-> Pb-> B = 69;
* (Pa-> PI) = 1000;
Cout <pa-> Pb-> B <Endl;
Cout <* (Pa-> PI) <Endl;
Return 0;
}
// ================================================ ================
// ================================================ ================
// Understanding of the so-called program execution starting from main
Class
{
Public:
A ()
{
Cout <"A" <Endl;
}
};
A;
Int _ tmain (INT argc, _ tchar * argv [])
{
Cout <"Main" <Endl;
Return 0;
}
// ================================================ ================
// ================================================ ================
// Quick Sorting Algorithm
Void swap (Int & A, Int & B)
{
Int temp;
Temp =;
A = B;
B = temp;
}
// Qsort function: sorts V [left]... V [right] in ascending order.
Void qsort (int v [], int left, int right)
{
Int I, last;
If (left> = right)
{
Return;
}
Swap (V [left], V [(left + right)/2]);
Last = left;
For (I = left + 1; I <= right; ++ I)
{
If (V [I] <V [left])
{
Swap (V [++ last], V [I]);
}
}
Swap (V [left], V [last]);
Qsort (v, left, last-1 );
Qsort (v, last + 1, right );
}
Int _ tmain (INT argc, _ tchar * argv [])
{
Int kk [] = {6, 9, 6, 4, 7, 3, 2, 3, 5, 7, 4 };
For (INT I = 0; I <11; ++ I)
{
Cout <kk [I] <'';
}
Cout <Endl;
Qsort (KK, 0, 10 );
For (INT I = 0; I <11; ++ I)
{
Cout <kk [I] <'';
}
Cout <Endl;
Return 0;
}
// ================================================ ================