Hey guys, I am very new to c++ and needed some help with a problem I can't seem to get. I need to generate shapes, an up arrow, and a sideways arrow. I have done the side arrow with no problem ( See code ). My issue comes when I am trying to do the same thing but vertically. I have tried a multitude of ways but can't seem to figure it out. Please let me know what I can try!
Thanks in advance.
Can PM me if it's easier, I'll be checking it often.
#include <iostream>
usingnamespace std;
int main ()
{
int i = 0;
int size = 12;
char letter = 'B';
while (i < size)
{
//1st half of arrow
if (i < size / 2 - 1)
{
int j = 0;
do
{
cout << ' ';
j++;
}
while (j < size / 2);
int k = 0;
do
{
cout << letter;
k++;
}
while (k < i + 1);
}
//makes the stem
elseif (i == size / 2 - 1 || i == size / 2)
{
int j = 0;
do
{
cout << letter;
j++;
}
while (j < size);
}
//2nd half of arrow
else
{
int j = size / 2;
do
{
cout << ' ';
j--;
}
while (j > 0);
int k = size - i;
do
{
cout << letter;
k--;
}
while (k > 0);
}
//creates new line
cout << endl;
i++;
}
while (i < size);
}