Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure what you're trying to acheive here or actually what the problem is that you're trying to get help with.</p> <p>You've highlighted a line which is not doing what you'd expect:</p> <pre><code> cout &lt;&lt; *target &lt;&lt; " "; //For some odd reason, this line BY ITSELF doubles up print. Ex. instead of printing 1 1 0 1 0, it would print 1 1 1 1 0 0 1 1 0 0. </code></pre> <p>However, this line is only outputting a bool so if changed to:</p> <pre><code>cout &lt;&lt; "[" &lt;&lt; *target &lt;&lt; "] "; </code></pre> <p>it gives:</p> <pre><code>. # # # # # # 1 [1] [254] 0 [0] [72] 0 [0] [0] 0 [0] [0] 0 [0] [77] 0 [0] [90] 0 [0] [0] [32] End of row. </code></pre> <p>Now you can see that since your code outputs the line read in and then iterates over that line, firstly outputting 1 if the character is a '.' and 0 if the character is a '#' but otherwise you do not assign a value so the <code>1 [1] [254]</code> at the beginning of the line is reading the first '.' character (<code>1 [1]</code>) and then ignoring a space (<code>[254]</code>)</p> <p>(note that you didn't publish code to assign initial values to your matrix of bools - not sure whether you're doing this, but you're certainly using the values in the matrix for output without necessarily setting them in this code. This explains the odd integer values.)</p> <p>Thus it isn't doubling up but just doing what you've asked it to. Perhaps you need to look at all the paths your code can take through the conditionals?</p>
    singulars
    1. This table or related slice is empty.
    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.
    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