Triple Nested For loop (C++) [closed]
i is not initialised before it’s read. That’s undefined behaviour. Didn’t your compiler warn you of this? Simple fix: use for (int i = 0; /*etc*/;
i is not initialised before it’s read. That’s undefined behaviour. Didn’t your compiler warn you of this? Simple fix: use for (int i = 0; /*etc*/;
Try This: <?php //connect to the database $con=mysql_connect(“localhost”,”root”,””) or die(“Error in connection”); mysql_select_db(“riffadb”,$con)or die(“Error in database”); // $sql1 =”select category_id,category_code from category”; $res1 = mysql_query($sql1); $i=0; $j=1000; while($row1 = mysql_fetch_array($res1)) { echo $row1[‘category_code’]; echo ‘<br/>’; // execute second query under the first loop $sql2 = “select category_id1,product_id from product”; $res2 = mysql_query($sql2); while($row2 = mysql_fetch_array($res2)) … Read more
Nested for loops like that are used when you have pseudo code like this: Do the following x times: Do the following y times: some stuff Do the following z times: some stuff In your specific case, the size of the pyramid is dynamic and is stored in a variable called size. To print a … Read more