#include<iostream> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <cmath> using namespace std; int main() { int s1[100], s2[100]; int min, max, n; min = 0; max = 0; n = 10; int temp; for (int i = 0; i < 10; i++) { scanf("%d", &s1[i]); } for (int i = 0; i < 10; i++) { if (s1[i] > s1[max]) { max = i; } } for (int i = 0; i < 10; i++) { for (int j = i; j < 10; j++) { if (s1[j] < s1[min]) { min = j; } } temp = s1[i]; s1[i] = s1[min]; s1[min] = temp; printf("%d\n", s1[i]); } return 0; } |
Double click to view unformatted code.