Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1682205
  • 博文数量: 210
  • 博客积分: 10013
  • 博客等级: 上将
  • 技术积分: 2322
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-25 15:56
文章分类

全部博文(210)

文章存档

2011年(34)

2010年(121)

2009年(37)

2008年(18)

我的朋友

分类: C/C++

2010-07-16 19:32:45

#include<iostream>
using namespace std;
int main(int argc, _TCHAR* argv[])
{
    char *s = "hello\t\tworld";
    cout<<s<<endl;
    char *s1 = new char[strlen(s)+1];
    char *temp = s1;
    while(*s!='\0'){
        if(*s!='\t'){
            *s1=*s;
            s1++;
            s++;
        }
        if(*s=='\t'){
            memset(s1,' ',4);
            s1+=4;
            s++;
        }
    }
    s1[strlen(s)+1]='\0';
    cout<<temp<<endl;
}


阅读(745) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~