Selection sort ascending
<p>That is my function:</p>

<pre><code>int main() {
    double data[100];

    int num;

    cout&lt;&lt;"num= ";
    cin&gt;&gt;num;

    for(int i = 1; i &lt;= num; i++) {
        cout&lt;&lt;i&lt;&lt;" element = ";
        cin&gt;&gt;data[i];
    }

    Sort(data, num);

    for (int i = 1; i &lt;= num; i++) {
        cout&lt;&lt;data[i]&lt;&lt;endl;
    }

    return 0;
}

void Sort(double data[], int n) {
    int i,j,k;
    double min;

    for(i = 0; i &lt; n-1; i++) {
        k = i;
        min = data[k];

        for(j = i+1; j &lt; n; j++)
            if(data[j] &lt; min) {
                k = j;
                min = data[k];
            }
        data[k] = data[i];
        data[i] = min;
    }
}
</code></pre>

<p>if I write for exp. three elements: 8,9,1 again cout 8,9,1?</p>
