Code a hollow diamond looking pattern

please send me the proper code of this program in C++ as i have wasted my whole 2 dyas on thsis particular problem
with explaination please help me out

this is not wasted it is investment
more you spend time on question to try and understand it more you got benifit

Approach
break the pattern in two halfs -> upper half and lower half
now in each half you have to print

  1. n-i stars
  2. 2*i-1 spaces
  3. n-i stars (but in first row there is one less star so consider that also)

copy the above code and reverse the loop of i for Lower portion

Modified Code

if you have doubt in this feel free to ask

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.