#include <stdio.h>
#define TABINC 8
int main(void)
{
int c,nb,nt,pos;
nb=0;
nt=0;
for(pos=1;(c=getchar())!='%';++pos)
{
if(c==' ')
{
if(pos%TABINC!=0){
++nb;
}else{
nb=0;
++nt;
}
}else{
for(;nt>0;--nt){
putchar('\t');
}
if(c=='\t'){
nb=0;
}else{
for(;nb>0;--nb){
putchar(' ');
}
}
putchar(c);
if(c=='\n'){
pos=0;
}else if(c=='\t'){
pos=pos+(TABINC-(pos-1)%TABINC)-1;
}
}
}
return 0;
}
entab函数
最新推荐文章于 2022-11-24 22:53:45 发布