zoukankan      html  css  js  c++  java
  • 反转字符串

    void reverse(char *group,int i,int j)

    {

        char c;

        while(i<j){

            c=group[i];

            group[i]=group[j];

            group[j]=c;

            ++i;--j;

        }

    }

    void reverse_list_word(char * group,int length)

    {

        reverse(group,0,length-1);

        int first=-1,second=-1,i=0;

        while(i<length){

            

            while(i<length && group[i]==' ') ++i;

            first=i;

            while(i<length && group[i]!=' ') ++i;

            second=i-1;

            

            if(first!=-1 && first!=length)

            {

                reverse(group,first,second);

                first =-1;second=-1;

            }

             

        }

        

    }

  • 相关阅读:
    ubuntu配置实验
    初始linux系统--ubuntu
    部署WSUS服务(一)
    web站点启用https (二)
    web站点启用https (一)
    windows 域的安装方法
    链表大合集(一)
    神奇的幻方
    二叉树的存储结构 以及重建二叉树
    html列表
  • 原文地址:https://www.cnblogs.com/sofard/p/10450901.html
Copyright © 2011-2022 走看看