language: Intercal (c-intercal 28.0-r1)
date: 120 days 19 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <algorithm>
using namespace std;
int array[10];
void setup(int max);
void sort();
 
int main() 
{
        srand(time(0));
        setup(100);
        sort();
        for (int x = 0; x < 10; x++)
        {
                cout << array[x] << ", ";
        };
        return 0;
}
void setup(int max)
{
        for (int x = 0; x < 10; x++)
        {
                array[x] = ((rand() % max)+ 1);
                cout << array[x] << ", ";
        };
        cout << endl;
};
 
void sort()
{       
        int count = 0;
        int small = 101;
        int recent = 0;
        for(int fail = 0; fail < 10; fail++)
        {
                small = 101;
                for(int one = fail; one < 10; one++)
                {
                        if (array[one] < small)
                        {
                                small = array[one];
                                recent = one;
                        };
                };
                swap(array[fail], array[recent]);
        };
 
}