Problem drawing with a for loop

Hello everybody,

I am writing a program to make a coordinate plane with a for loop but it is giving me some grief...

i am trying to draw this:

" ^ "

with:
for (int i = 0; i <= 10; i++)
{
if (i < 5) cout << " ";
if (i = 5) cout << "^";
if (i > 5) cout << " ";
}

but they output is:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This:

if (i = 5) cout << "^";

should be:

if (i == 5) cout << "^";

Topic archived. No new replies allowed.