The types of values we use in general are: shaping and floating-point type
Int
Double, float
In the calculation we should pay attention to defining variables, shaping the calculation back to integer, and floating-point calculation will retain 6 decimal places (general)
1, note the floating-point input and output format symbol a little difference: the input is:%LF output:%f,
eg
scanf (%lf,&a);//input
printf (%f,a);//Output
Basic calculation structure:
If If...else if the If branch is less, use a single outlet is better, the pattern design is the same, such as frame: thinkphp is also a single entrance, export
Switch...case default: Many times, we should be good at and If......else statements to convert, such as through the related method to convert If...else statements
Looping statements
While first judge, after content execution body
Do While the content body executes, and then judge
for a loop with a base
Note Keywords:
Continue: This is the end of the cycle, in the next cycle (do not jump out of the loop body, but this time the loop does not go to the following)
Break: ends the loop, jumps out of the current loop, and does not jump out of all loops.
Notice the nesting relationship in the loop, which is the problem of design to complexity
Frequently-given examples:
Find the prime, change, sum, greatest common divisor, inverse number
Summarize:
1, the structure of the basic program
2, the structure between the characteristics and continuous, their difficulty between the increment, the use of the scene.
Here is a picture of the design to the knowledge point:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Basic review of C language