Replace them all

#include
#include
using namespace std;

int NoOfDigits(int a){
int count=0;
if(a==0){
count=1;
}
else{
while(a>0){
a/=10;
count++;
}
}

return count;

}

int main(){
int n;
cin>>n;
// int n=abs(b);
int a=NoOfDigits(n);
int new_no=0;

for(int i=1 ; i<=a ; i++){
    int temp=0;
    temp=n%10;
    if(temp==0){
        new_no+=5*(std::round(pow(10,i-1)));
    }
    else{
        new_no+=temp*(std::round(pow(10,i-1)));
    }
    n/=10;

}
cout<<new_no<<endl;
// if(b>=0){
//     cout<<new_no<<endl;
// }
// else{
//     cout<<(-1)*new_no<<endl;
// }
return 0;

}
why is this code not working