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;

            }

             

        }

        

    }

  • 相关阅读:
    IntelliJ IDEA 修改内存大小,使得idea运行更流畅。(转发)
    QueryRunner使用总结
    C#中static修饰符的作用
    Design Support库中的控件
    关于tomcat部署项目的问题
    让后台服务一直运行
    活动和服务的通信
    服务的用法
    数组右移问题
    素数对猜想
  • 原文地址:https://www.cnblogs.com/sofard/p/10450901.html
Copyright © 2011-2022 走看看