C / C ++ remove the end of the line spaces

for(int i = 0;i < n;i++){
    if(i == 0){
        cout << a[i];
    } else{
        cout << " " << a[i];
    }
}
for(int i = 0;i < n;i++){
    if(i == 0){
        printf("%d",a[i]);
    } else{
        printf(" %d",a[i]);
    }
}
Published 13 original articles · won praise 0 · Views 250

Guess you like

Origin blog.csdn.net/weixin_45019478/article/details/104563778