1. Conditional Include
As follows:
# Ifndef main_h _
# Define main_h _
......
# Endif
When we see the header file above, we will see that the function is to prevent this header file from being included multiple times, and repeated definitions
Recently, I accidentally found a split function written by someone else on the Internet: vector split (const string & SRC, string delimit,
String null_subst = "")
...{
If (SRC. Empty () | delimit. Empty () throw "split: empty string 0 ";
Vector
Reproduced, original address: http://www.cnblogs.com/cocoulong/archive/2010/01/30/1660119.html
// Obtain the complete path of the current process, including the file name (process name ).String STR = This. GetType (). Assembly. location;Result: X:
1. extern is a keyword in C/C ++ that indicates the range (visibility) of functions and global variables. This keyword tells the compiler, the declared functions and variables can be used in the "Global" range.
2. exterc "C" ("C" must be capitalized)
1. A guy wrote a webpage to view the C/C ++ syntax in BNF format.
2. There is something called FFI (Foreign function interface) that contains many languages and information about many platforms.
3. stackoverflow,
Codeproject,
C ++ 11 FAQ,
Document directory
Memcpy and egg pain writing:
The implementation of string operation functions in C/C ++ is very skillful. Although these functions are simple and self-implemented, there are still many things to consider, therefore, if you have
1. Input three numbers and output them in ascending order;
# Include Int min (int * P1, int * P2){If (* P1> * P2)Return * P2;ElseReturn * P1;}Int max (int * P1, int * P2){If (* P1 Return * P2;ElseReturn * P1;}
Void sort (int * P1, int * P2, int *
1. assign an array value to another array and rewrite the code to a vector.
# Include using namespace STD; int main () {size_t array_size = 7; int ia1 [] = {0, 1, 2, 3, 4, 5, 6}; int ia2 [array_size]; // copy the array in C ++. You can only
1. Write a function using a pointer to exchange two integer numbers a and B read from the keyboard;
# Include # Include Void swap (int * P1, int * P2 ){Int temp;Temp = * P1;* P1 = * P2;* P2 = temp;}
Int main (){Int X, Y;Printf ("enter two numbers:
Document directory
1. Basic concepts of the thread, the basic state of the thread, and the relationship between states.
2. Differences between threads and processes
3. Thread Synchronization and mutex
4. Causes of deadlocks and how to avoid
# Include
/* Function power test */
Int power (int m, int N );
Main ()
{
Int I;
For (I = 0; I
Printf ("% d/N", I, power (2, I), power (-3, I ));
Return 0;
}
/* Power function: Calculate the N power of the base number, where n> = 0 */
Int power
This series of articles is a book note for Lippman's "inside the C ++ object model.
1. Books on C ++ made by author Lippman: C ++, one of the first compilers:
C ++ Primer: The Encyclopedia of C ++, which is the same name as C ++ programming
In the C language, functions are implemented directly in the header file for convenience (the synonym for convenience is laziness. So what's the problem?
In the following example, there are only three files.
/* Fun. H */# Ifndef fun_h# Define
Original article: http://blog.csdn.net/jiangnanyouzi/article/details/3721091#reply
In "Deep Exploration C ++ object model", there is a question that is frequently asked by the technical staff when they go to a company interview: In C ++, OBJ is a
This is the C/S structure in the C ++ Socket network program. TCP "Hello world! ", There are two console projects:
//////////////////////////////////////// /// // // tcpserver. CPP # include # include # pragma comment (Lib, "ws2_32.lib ") #
This is the C/S structure in the C ++ Socket network program. UDP "Hello world! ", There are two console projects:
//////////////////////////////////////// /// // // udpserver. CPP # include # include # pragma comment (Lib, "ws2_32.lib ") #
Although the Ubuntu version is already 9.10, I don't want to upgrade it. After all, the 256 memory is really hard to handle. For me, stability is the most important thing. The hardware does not need to be too high, so it is still honestly stuck at 9.
The bin directory is used to store compilation results. Bin is the abbreviation of binary binrary, because the program files compiled by C are binary files, which have two versions: Debug and release, the corresponding folders are bin/debug and
1. http://snippets.dzonE.com/tag/c/-- Thousands of useful C language source code snippets2. http://www.hotscriptS.com/category/c-cpp/Scripts-programs/Hotscripts-- Provides hundreds of C and C ++ scripts and programs. All programs are classified into
First, you must understand what they are composed:
Stream: Binary
Byte: unsigned integer
Character: unicode encoded character
String: Multiple Unicode characters
In. net, how can they be converted?
Generally, the following rules are
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service