使用printf()设置输出字段长度 printf(“%*s”,name); 星号可以直接替换为int型常量,如printf(“%6s”,name); 也可以用这种方法 printf(“%*s”,10,name);