1.SCANF and printf use significantly less time than cin and cout consume.
The 2.Gets () function is used to read a whole line of functions, can be infinitely read, do not judge the upper limit, encountered the end of the return, use caution.
The Getchar () function can read one character at a time, and this character can be a carriage return. Putchar () corresponds to the output of one character.
3.EOF is a predefined constant, equal to -1.
Both 4.Strcmp () and compare () are used to compare two strings, returning 0the same time, which returns 1larger than the latter ( Strcmp returns a positive number ), the former smaller than the latter returns -1 (strcmp Returns a negative number ).
Fractional Precision control in 5.c++:
① header file #include <iomanip>
②cout<<setiosflags (ios::fixed) <<setprecision ( number of decimal digits controlled ) <<number<< Endl;
6.C language can be entered in a set format ( very useful )!
For example, you need to enter 2016/2/14 This format
The input is done directly with scanf ("%d/%d/%d", &a,&b,&c) . Other methods I'm not.
7. When considering leap years, it is sometimes considered whether the month exceeds 2 months.
8. Learn to use the assert macro. #include <assert.h> assert (x>=0) executes when x satisfies a non-negative, otherwise terminates abnormally.
9.long long in the C language input scanf ("%i64d", &n). when output printf ("%lld", a) .
10. The string includes the Terminator ' + '. strlen () The function does not count the bytes of '% '. Strlen () Need header file string.h .
11. Ranking problem, commonly used structure.
12. The only way to add a space in the middle of the result:
Int b=0;
Printf (b++?) "%d": "%d", a);
The former has a space and the latter does not.
13.c++ uses a mathematical function to refer to the header file math.h , directly with sqrt (x).
Introduction to ACM Small summary