Please help me find the error in my code.I am not able to fix the spacing error.please help me correct my code

#include
using namespace std;
int main(){
int N;
cin>>N;
int row;
int p=1;
int w=N+1;
for(row=1;row<=N;row++){
int val=N;
for(int i=1;i<=row;i++){
cout<<val;
val=val-1;
}
for(int space=1;space<=(2N+1-2row);space++){
cout<<" “;
}
val=val+1;
for(int i=1;i<=row;i++){
cout<<val;
val=val+1;
}
cout<<endl;
}
if(row==N+1){
int val=N;
for(int i=1;i<=N+1;i++){
cout<<val;
val=val-1;
}
val=val+2;
for(int i=1;i<=N;i++){
cout<<val;
val=val+1;
}
cout<<endl;
}
for(int row= N+2 ;row<=(2N+1);row++){
int val=N;
for(int i=1;i<=(row-p
2);i++){
cout<<val;
val=val-1;
}
//spaces
for(int space=1;space<=(row-w);space++){
cout<<” ";
}
val=val+1;
for(int i=1;i<=(row-2*p);i++){
cout<<val;
val=val+1;
}
cout<<endl;
p = p+1 ;
w = (w - 1);
}
return 0;
}

@shresth_2000 please share your code using CB ide

now please help

Hi @shresth_2000 count the spaces given after each number you are not printing any spaces at all

still not able to fix spacing issues.please help and explain this

@shresth_2000 https://ide.codingblocks.com/s/295437

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.