C language
First, the goal
A) SRS---analysis-Draw Flowchart---Code
b) give you a procedure. Can understand the implementation process. Write execution results
c) Develop a good coding habit---code before you need to stare
Pave the mat for performance tests and lay the groundwork for learning other languages later. Increase the depth of the test
Note: No basic---more practice; basic---depth/help
Second, the course arrangement
A) First day
I. What is the procedure
Ii. Composition of the program
III. process-oriented programming ideas
Iv. definition and use of functions
b) the next day
I. Algorithm---branch of the program
II. algorithm---Cycle of the program
c) The third day
I. Other data structures of the program
1. Arrays
2. Structural body
II. Design analysis of shopping system
First day
I. The history of language
Ii. Composition of the procedure
program = data structure + algorithm
function = input/output + processing logic
Data:
1 + 1 = 2 fixed, known--- constant
x + y = z change, unknown--- variable
X1+x2+x3+......= y changes. Unknown, a set of the same type--- array
Name, age, salary different types, multiple groups, unknown--- structure of the change
Data type:
int---integer (integer), Float---float (6 decimal places), char---character type (alphabetic, numeric, kanji)
Double---dual precision (12 decimal places)
Algorithm:
Order
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">
Branch
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">
Cycle
Three, process-oriented programming ideas
Example: Finding the sum of two integers
Analysis:
1. Identify data structures and types
Data structure: input---Two variables; output: A variable
Data type: int
2. Determine the algorithm
Order
3. Draw a flowchart
4. Copy the text in the flowchart into the code template as a gaze. Translate the gaze into code
Single Gaze--// multi-line gaze--*/* XXX */
Code Template:
1, Program Description: Description of the program to achieve the function
2. header file: #include <stdio.h>
<stdio.h> standard input and output header file, you need to use some functions in the header file, so you need to load the program in advance
<string.h> String Header File
3, function declaration (own definition function need):
4, the main function of the implementation: Voidmain ()
5, the implementation of their own definition functions:
1. Define variables:
I
The first day of C language learning