Number of numbers

xiaoxiao2021-03-05  48

#include

#define Number 5

File * fp;

Void Print_Array (int P []) {INT i; for (i = 0; i

Void Print_Array_fp (int P []) {INT i; for (i = 0; i

Void Swap (INT & X, INT & Y) {INT TEMP = X; X = Y; Y = Temp;}

// Use recursive vid f (int p [】, int start, int end) {INT i;

IF (start == End) Print_Array (P); // Print the value of the P array else {for (i = start; i <= end; i ) {

FPRINTF (FP, "i =% D, start =% D, END =% D THEN SWAP1 P [Start], P [i]:", I, START, END); SWAP (P [Start], P [i ]); // SWAP exchanges the value of the two variables Print_Array_fp (p);

FPRINTF (FP, "F (% D,% D) / N", start 1, end); f (p, start 1, end);

FPrintf (fp, "i =% d, start =% d, end =% d THEN SWAP2 P [Start], P [I]:, I, START, END); SWAP (P [Start], P [i ]); Print_Array_fp (p);

}}}

Void main () {fp = fopen ("c: //Result.txt", "w t");

INT DATA [Number] = {1, 2, 3, 4, 5};

f (Data, 0, 4);}

转载请注明原文地址:https://www.9cbs.com/read-31933.html

New Post(0)