organizing array from least to greatest c++
<p>Hi I'm working on a project that lets the user input numbers and the code organizes them in order of least to greatest and tells how many of each number was input. I'm having problems with the organizing of least to greatest and counting how many of each number are inputed</p>

<pre><code>using namespace std;
#include &lt;iostream&gt;

void main(){
    double a[30];
    double e[30];
    double b;
    int c[30];
    int d;
    double f=0;
    cout &lt;&lt; "how many input values [max 30]:";
    cin &gt;&gt; d;
    cout &lt;&lt; "enter " &lt;&lt; d &lt;&lt; " numbers:"&lt;&lt;endl;
    for(int x=0; x&lt;d;x++){
        cin &gt;&gt; a[x];
        c[x]=0;
    }
    cout &lt;&lt; endl;
    for(int y=0; y&lt;d;y++){
        if(a[y]&gt;=f){
            f=a[y];
        }
    }
    for(int z=0;z&lt;d;z++){
        if(a[z]){
            c[z]++;
        }
        if(a[z]&gt;=a[z+1]){
            e[z]=a[z];
        }
    }
    cout &lt;&lt; "numbers       count"&lt;&lt; endl;
    for(int printloop=0;printloop&lt;d;printloop++){
        if(a[printloop]&gt;0){
            cout &lt;&lt; e[printloop]&lt;&lt; "               " &lt;&lt; c[printloop] &lt;&lt; endl;
        }
    }
    cout &lt;&lt; "max value:" &lt;&lt; b &lt;&lt; endl;
}
</code></pre>