欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C語言

當(dāng)前位置:主頁(yè) > 軟件編程 > C語言 >

華為面試題答案找出最大長(zhǎng)度子字符串

來源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:C語言|點(diǎn)擊: 次

復(fù)制代碼 代碼如下:

int findMaxSubstring(char* str)
{
    int maxLength = 0;
    int maxStartIndex = 0;
    int curLength = 0;
    int curStartIndex = 0;
    bool isFind = 0;
    for(unsigned int i = 0;i<strlen(str);i++)
    {
        if(str[i] >= 'a' && str[i] <= 'z')
        {
            if(isFind == 0)
            {
                isFind = 1;
                curLength = 1;
                curStartIndex = i;
            }
            else
            {
                curLength++;
            }
        }
        else if (str[i] < 'a' || str[i] > 'z')
        {
           isFind = 0;
           if(curLength > maxLength)
           {
              maxLength = curLength;
              maxStartIndex = curStartIndex;
              curLength = 0;
           }
        }
    }
    char *p = NULL;
    p = &str[maxStartIndex];
    while(*p >= 'a' && *p <= 'z')
    {
        putchar(*p);
        p++;
    }
    return maxLength;
}

上一篇:冒泡算法的改進(jìn)具體實(shí)現(xiàn)

欄    目:C語言

下一篇:獲取本地網(wǎng)卡適配器信息具體代碼

本文標(biāo)題:華為面試題答案找出最大長(zhǎng)度子字符串

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/3851.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有