C/C++去除行末空格

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]);
    }
}
发布了13 篇原创文章 · 获赞 0 · 访问量 250

猜你喜欢

转载自blog.csdn.net/weixin_45019478/article/details/104563778