April 22, 1998

Adding to the front of an array

Question: I have to read in integers and be able to add them to the front of the array. How do I do this? Answer: You can either use the

Sorting in a ListView

Question: I would like to know how to program a Custom Sort procedure on a ListView in Borland’s C++ Builder. Answer: Normally, the ListView control will sort items automatically for

Return type _Cdecl

Question: I have seen that in many of the header files in C++ the return type is _Cdecl. For example, in complex.h, we have the following: friend complex _Cdecl acos(complex&)

Quick sort

Question: I have pseudocode for a quick sort. I know how to implement it in Pascal. Is there simple code for quick sort in C++? How can I find other

External file execution

Question: How can I code a Visual C++ program that will execute a DOS bat file? Or any other executable file, for that matter? Answer: Use the system() function. This

Functions and parameters

Question: I know this may sound like a dorky question, but can you explain to me?as if I were a little kid?what are functions, and why and how are parameters

Pointers to member functions

Question: I am having lots of trouble calling a class member function pointer that is declared within the same class. So far the following compiles: class testClass {public: void (testClass::*ptr)();

Integer lengths

Question: What function gives the actual length of an integer or long integer? For instance, 8 is 1 long, 12345 is 5 long, etc. Answer: Use the sizeof() operator to

Performance—C vs C++

Question: What are the performance tradeoffs of using C++ instead of C? Are there any ways of overcoming these tradeoffs? Answer: In general, C++ is every bit as efficient as