#include <stdio.h> #include <stdlib.h>void swch(int A[3], int one, int two){ int temp=A[one]; A[one]=A[two]; A[two]=temp; return; } int main(){ int A[3] = {34, 21, 100}; swch(A, 1, 2); if(A[0] > A[2]) swch(A, 0, 2); if(A[1] > A[2]) swch(A, 1 ,2); if(A[0] > A[1]) swch(A, 0, 1); printf("%d, %d, %d\n", A[0], A[1], A[2]); system("pause"); return 0; }
|