Recently went to the library to learn C language books, feel by < Mei >al Kelley and Ira Pohl-Mazhi translation of the "C Language Analysis Tutorial" translated very good, especially the C language learning method (of course, I still compare the suggestion to learn the two languages and then do a good tour), In the process of learning C language, interspersed with c++!
In the C language of the road, I still want to work hard is!
1. Programs that do not contain header files can also be run!
int Main () { int a=3, b=4; return 0 ;}
2. If a and B are variables of type int, where one or two are negative, the value of A/b is system-dependent and is determined by the system.
Variables of type 3.float are usually added to the right of the assignment statement with F.
A constant of 4.long double is added to L.
5. When the constant is a double type, the variable is of type float, so there is no problem.
Note: Floating-point types can be freely mixed in expressions and assignments.
float x, y; X=1.0// Note: This sentence and the following sentence are missing F y=2.0;
6. The Division of floating-point numbers is the same as people's imagination, according to normal division.
Example: 7.0/2.0=3.5
7. In a floating-point expression, 0 is not allowed to divide, otherwise a value that is not a number may be generated.
Note: This can be run in dev, displaying values that are not numbers, which, under vc++6.0, will give an error and the executable program cannot be generated.
header files such as stdio.h in a 8.UNIX system are typically in/user/include
9. #define can appear anywhere in the program, affecting only those rows that follow it in the file.
Note: Usually after # include, the changed identifiers are written in uppercase
10. Formatting control in the printf () function
Floating point number of%e scientific counting method
%g in E-format or F-format, takes a shorter one
11. The address of a variable is the address stored in the variable memory. (Here's a question: What's the difference between this memory and storage?) )
12.SCANF () function format control character
LF stands for double
LF represents a long double
13. In the traditional C language, long float is synonymous with float, but in Ansic C, there is no long float.
Note: Do not consider this article now, understand can.
14.
while (scanf ("%f", &x) = =1);
Indicates that if successful, convert the user input character to float type to save X, success is true, failure returns 0, no re-use return-1
In 15.UnIx, a carriage return followed by Ctrl+d is a typical end-of-file flag.
16. Note: In an interactive environment, it is not an error for a program to use a dead loop!
17. In Unix, common CTRL + C interrupts the program.
In 18.UNIX, the command ls>temp is to write the contents of the previous output to the screen to a file, which is referred to as redirection.
C++
The 1.c++ I/O library is iostream.h
2.
count<<"hello,world! "<<endl;
Count represents the screen
<< is putting a string into the output stream
Endl for refreshing output and moving to a new line
In the 3.c++ program, return 0 can be ignored;
Note: This statement is inserted because of its implication.
4. Greatest common Divisor
while (n!=0) { R=m%N; M=N; n=r; } // the final output of M is greatest common divisor
5.cin is usually the standard input stream associated with the keyboard.
cin>>m>>n;
6. Note:
1 Finder = 6 feet
1 feet = 12 inches
1 yards = 36 inches
Review the C language Parsing tutorial (i)