一道筆試題目實(shí)習

時(shí)間:2022-07-03 00:51:28 筆試 我要投稿
  • 相關(guān)推薦

一道筆試題目(實(shí)習)

用C/C++寫(xiě)一個(gè)函數,它的原形是int continumax(char *outputstr,char *intputstr) 功能:在字符串中找出連續最長(cháng)的數字串,返回這個(gè)串的長(cháng)度,并把這個(gè)最長(cháng)的數字串付給其中一個(gè)函數參數outputstr所指內存。例如:"abcd12345ed125ss123456789"的首地址傳給inputstr后,函數將返回9,outputstr所指的值為123456789。

一道筆試題目(實(shí)習)

#include

#include

#include

int continumax(char *outputstr,char *inputstr){

if((outputstr==NULL)||(inputstr==NULL))

return 0;

char *current=inputstr;

char *max_start=NULL;

int len=0,max_len=0,ret_len=0;

while(true)

{

if((*current>=99久久精品免费看国产一区二区三区|baoyu135国产精品t|40分钟97精品国产最大网站|久久综合丝袜日本网|欧美videosdesexo肥婆