Traditional Culture Encyclopedia - Traditional stories - Traditional programming process

Traditional programming process

First, choose an intermediate value, such as t or k, here take t as an example.

Then compare a, b and c in turn;

First, compare the values of A and B. If A is greater than B, then exchange A and B with T; Then compare the values of a and c, and if a is greater than c, exchange the values of a and c with t; Finally, compare the values of B and C. If B is greater than C, exchange the values of B and C with T; ? Then you can output a, b, and c in turn from small to large.

Specific procedures:

# include & ltstdio.h & gt

void main()

{

int a,b,c,t;

Printf ("Enter A, B and C in turn:");

Scanf("%d%d%d ",& i, & ampb & amp;; c);

What if (a>b)? { t = a; a = b; b = t; }

If (a & gtc){ t = a;; a = c; c = t; }

What if (b>c)? { t = b; b = c; c = t; }

Printf ("output a=%d, b=%d, c =% d \ n ",a, b, c in descending order);

}

Flowchart: It is an excellent method to express the idea of algorithm with graphics, because a thousand words are not worth a picture. Flowchart has been applied in assembly language and early BASIC language environment. There is also a related PAD diagram, which is very suitable for PASCAL or C language.

Data flow chart Data flow chart indicates the data path to solve the problem, and also specifies the main stages of processing and various data media used.

The data flow chart includes:

Data symbols indicating the existence of data, and these data symbols can also indicate the media used by data;

Processing symbols that represent data processing, and these symbols can also represent machine functions used in processing;

Streamline symbols representing data flow between several processing and/or data media;

Special symbols for reading and writing data flow diagrams. Data symbols should be used before and after processing symbols. Data flow charts begin and end with data symbols (except special symbols specified in 9.4).