Nested loop shape help

Apr 2, 2015 at 3:05am
Hi I'm trying to get this design done here and I'd love some help finished result or possible steps trying to learn http://i.imgur.com/hJl48LS.jpg For the design I'm trying to make

#include<iostream>

#include<cstdlib>

using namespace std;

int main()

{

int i = 0, j = 0, NUM = 3;

for (i = -NUM; i <= NUM; i++)

{

for (j = -NUM; j <= NUM; j++)

{

if (abs(i) + abs(j) <= NUM)

{
cout << "*";
}

else { cout << " "; }

}

cout << endl;

}
return 0;

I ended up with this its the right shape by asterisks but is that the closest ill get?
Last edited on Apr 2, 2015 at 9:01pm
Apr 2, 2015 at 3:43am
Most people here will not help you unless you show some proof that you have attempted the problem.
Apr 2, 2015 at 4:39am
In the process of working right now just dont really know how to start
Apr 2, 2015 at 7:09am
Google nested loops. Youtube nested loops.
Topic archived. No new replies allowed.