Note that there are some explanatory texts on larger screens.

plurals
  1. POHistogram Calculating program
    primarykey
    data
    text
    <pre><code>#include &lt;iostream&gt; #include &lt;math.h&gt; using namespace std; int main() { int arraylength; int lastbig = 0; int lastsmall = 0; int temp = 0; int numofgroups = 0; double gg = 0; cout&lt;&lt;"Enter the number of numbers you are going to enter "&lt;&lt;endl; cin&gt;&gt;arraylength; int data[arraylength]; for(int ahmet = 0;ahmet &lt; arraylength;ahmet++) { cout&lt;&lt;"Enter the num no."&lt;&lt;ahmet+1&lt;&lt;endl; cin&gt;&gt;data[ahmet]; } for(int bbm = 0;bbm &lt; arraylength;bbm++) { if(data[bbm]&gt;lastbig) { lastbig = data[bbm]; } } cout&lt;&lt;"Biggest "&lt;&lt;lastbig&lt;&lt;endl; for(int ddr = 0;ddr &lt; arraylength;ddr++) { if(data[ddr]&lt;lastbig &amp;&amp; lastsmall == 0) { lastsmall = data[ddr]; } else if(data[ddr]&lt;lastsmall) { lastsmall = data[ddr]; } } cout&lt;&lt;"smallest "&lt;&lt;lastsmall&lt;&lt;endl; temp = lastbig-lastsmall; cout&lt;&lt;"Enter the number of groups you want"&lt;&lt;endl; cin&gt;&gt;numofgroups; gg = (double)temp/numofgroups; cout&lt;&lt;"gg ="&lt;&lt;gg; gg = ceil(gg); cout&lt;&lt;"gg ="&lt;&lt;gg&lt;&lt;endl; int z = 0; int lastnumleft = 0; struct groups { int min; int max; int membercount; }group[numofgroups]; int tmp = lastsmall; for(int dinghy = 0;dinghy&lt;numofgroups;dinghy++) { if(dinghy == 0) { group[dinghy].min = tmp; group[dinghy].max = tmp + ((int)gg - 1); tmp = tmp + (int)gg; } else{ group[dinghy].min = tmp; group[dinghy].max = tmp+((int)gg-1); tmp = tmp + (int)gg; } } for(int jpn = 0;jpn&lt;numofgroups;jpn++) { for(int mtr = 0;mtr&lt;arraylength;mtr++) { if(data[mtr]&gt;group[jpn].min&amp;&amp;data[mtr]&lt;group[jpn].max) { group[jpn].membercount++; } } } for(int dingil = 0;dingil&lt;numofgroups;dingil++) { if(!group[dingil].membercount){ group[dingil].membercount = 0; } } for(int xyz = 0;xyz&lt;numofgroups;xyz++) { cout&lt;&lt;group[xyz].min&lt;&lt;" - "&lt;&lt;group[xyz].max&lt;&lt;" "&lt;&lt;group[xyz].membercount&lt;&lt;endl; } cin.ignore(); cin.get(); return 0; } </code></pre> <p>This program actually does the calculations needed for making a histogram member count of groups and min max of numbers but i cant group the numbers can you help me :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload