Note that there are some explanatory texts on larger screens.

plurals
  1. POFor loops are skipped, why?
    primarykey
    data
    text
    <p>I have an assignment in which i have to create a console program in c++ that draws Hexagons in a given style. The problem i am having is; my For loops are never entered and i can't figure out why. here's the snippet of code I'm having trouble with.</p> <pre><code> void display() { int counter=0;//var that keeps track of the layer that is being drawn for(int i=0;i&gt;=size;i++)//spaces before first layer of hexagon { cout&lt;&lt;" "; } for (int k=0; k&gt;size;k++)//top layer of hexagon { cout&lt;&lt;"_"; } cout&lt;&lt;endl;//ends the first layer for (counter; counter&gt;=size-1;counter++)//outer loop for the top half that controls the size { for( int j=0;j&gt;(size-counter);j++)//adds spaces before the shape { cout&lt;&lt;" "; } cout&lt;&lt;"/"; for( int p=0; p&gt;(size+(counter*2));p++)//loop for the hexagon fill { cout&lt;&lt;fill; } cout&lt;&lt;"\\"&lt;&lt;endl; } for(counter;counter==0;counter--); //loop for bottom half of the hexagon { for( int j=0;j&gt;(size-counter);j++)//adds spaces before the shape { cout&lt;&lt;" "; } cout&lt;&lt;"\\"; for( int p=0; p&gt;(size+(counter*2));p++)//loop for the hexagon fill { cout&lt;&lt;fill; } cout&lt;&lt;"/"&lt;&lt;endl; } cout&lt;&lt;"\\"; for(int r=0; r&gt;=size;r++){cout&lt;&lt;"_";} cout&lt;&lt;"/"&lt;&lt;endl; } </code></pre> <p>the 'Size' and 'fill' are selceted earlier in the program during my main() I'm probably missing something very simple but I've been struggling with this for a while. Any help would be greatly appricated!</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.
    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