Mirror star pattern (pattern 5a)

#include
using namespace std;
int main()
{
int row;
cin >> row;
for (int i = 0; i < row; i++)
{
if (i < row / 2 + 1)
{
int csp = row - i;
for (int j = 0; j < csp; j++)
{
cout << " ";
}
for (int j = 0; j < 2 * i + 1; j++)
{
cout << "* ";
}
}
else
{
int csp = i + 1;
for (int j = 0; j < csp; j++)
{
cout << " ";
}
for (int j = 0; j < 2 * (row - 1 - i) + 1; j++)
{
cout << "* ";
}
}

    cout << "\n";
}

}

//what is wrong in this code cannot understand i am getting right output

The code incorrectly calculates spaces of the diamond.

You can refer my code as well

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.