毛片在线视频观看,一级日韩免费大片,在线网站黄色,澳门在线高清一级毛片

薈聚奇文、博采眾長(zhǎng)、見(jiàn)賢思齊
當(dāng)前位置:公文素材庫(kù) > 公文素材 > 范文素材 > PPTV_201*校園招聘研發(fā)類(lèi)筆試題

PPTV_201*校園招聘研發(fā)類(lèi)筆試題

網(wǎng)站:公文素材庫(kù) | 時(shí)間:2019-05-29 05:40:04 | 移動(dòng)端:PPTV_201*校園招聘研發(fā)類(lèi)筆試題

PPTV_201*校園招聘研發(fā)類(lèi)筆試題

擴(kuò)展閱讀:201*華為校園招聘軟件研發(fā)筆試題

1、刪除子串,只要是原串中有相同的子串就刪掉,不管有多少個(gè),返回子串個(gè)數(shù)。#include#include#include#include

intdelete_sub_str(constchar*str,constchar*sub_str,char*result){

assert(str!=NULL&&sub_str!=NULL);constchar*p,*q;char*t,*temp;p=str;

q=sub_str;t=result;

intn,count=0;n=strlen(q);

temp=(char*)malloc(n+1);memset(temp,0x00,n+1);while(*p){

memcpy(temp,p,n);

if(strcmp(temp,q)==0){

count++;

memset(temp,0x00,n+1);p=p+n;}else{

*t=*p;p++;t++;

memset(temp,0x00,n+1);}}

free(temp);returncount;}

voidmain(){

chars[100]={‘\\0’};

intnum=delete_sub_str(“123abc12de234fg1hi34j123k”,”123”,s);printf(“Thenumberofsub_stris%d\\r\\n”,num);printf(“Theresultstringis%s\\r\\n”,s);}

2、約瑟夫環(huán)是一個(gè)數(shù)學(xué)的應(yīng)用問(wèn)題:已知n個(gè)人(以編號(hào)1,2,3...n分別表示)圍坐在一張圓桌周?chē)木幪?hào)為k的人開(kāi)始報(bào)數(shù),數(shù)到m的那個(gè)人出列;他的下一個(gè)人又從1開(kāi)始報(bào)數(shù),數(shù)到m的那個(gè)人又出列;依此規(guī)律重復(fù)下去,直到圓桌周?chē)娜巳砍隽小?include#includetypedefstructNode{

intnum;

structNode*next;}LinkList;

LinkList*creat(intn){

LinkList*p,*q,*head;inti=1;

p=(LinkList*)malloc(sizeof(LinkList));p->num=i;head=p;

for(i=2;inum=i;p->next=q;p=q;}

p->next=head;/*使鏈表尾指向鏈表頭形成循環(huán)鏈表*/returnhead;}

voidfun(LinkList*L,intm){

inti;

LinkList*p,*s,*q;p=L;

printf("出列順序?yàn)?");while(p->next!=p){

for(i=1;inext;}

printf("%5d",p->num);s=p;

q->next=p->next;p=p->next;free(s);}

printf("%5d\\n",p->num);}

intmain(){

LinkList*L;intn,m;n=9;m=5;

L=creat(n);fun(L,m);return0;}

3、比較一個(gè)數(shù)組的元素是否為回文數(shù)組#include#includeinthuiwen(charstr[]){

inti,len,k=1;len=strlen(str);

for(i=0;i#include#include

intarray_compare(intlen1,intarray1[],intlen2,intarray2[]){

intcount=0;

for(;len1>=0&&len2>=0;len1--,len2--){

if(array1[len1-1]!=array2[len2-1]){

count++;}}

returncount;}

intmain(){

intresult=0;

intarray1[]={1,3,5};intlen1=3;

intarray2[]={77,12,1,3,5};intlen2=5;

result=array_compare(len1,array1,len2,array2);///result=array_compare(len1,array1[],len2,array2[]);不能這樣

//函數(shù)形參中永遠(yuǎn)只是傳得首地址,不能傳數(shù)組切記切記。。。。!printf("theresultis%d",result);}

5、隨機(jī)數(shù)按計(jì)數(shù)輸出

問(wèn)題描述:

輸入一個(gè)由隨機(jī)數(shù)組成的數(shù)列(數(shù)列中每個(gè)數(shù)均是大于0的整數(shù),長(zhǎng)度已知),和初始計(jì)數(shù)值m。從數(shù)列首位置開(kāi)始計(jì)數(shù),計(jì)數(shù)到m后,將數(shù)列該位置數(shù)值替換計(jì)數(shù)值m,并將數(shù)列該位置數(shù)值出列,然后從下一位置從新開(kāi)始計(jì)數(shù),直到數(shù)列所有數(shù)值出列為止。如果計(jì)數(shù)到達(dá)數(shù)列尾段,則返回?cái)?shù)列首位置繼續(xù)計(jì)數(shù)。請(qǐng)編程實(shí)現(xiàn)上述計(jì)數(shù)過(guò)程,同時(shí)輸出數(shù)值出列的順序

比如:輸入的隨機(jī)數(shù)列為:3,1,2,4,初始計(jì)數(shù)值m=7,從數(shù)列首位置開(kāi)始計(jì)數(shù)(數(shù)值3所在位置)第一輪計(jì)數(shù)出列數(shù)字為2,計(jì)數(shù)值更新m=2,出列后數(shù)列為3,1,4,從數(shù)值4所在位置從新開(kāi)始計(jì)數(shù)第二輪計(jì)數(shù)出列數(shù)字為3,計(jì)數(shù)值更新m=3,出列后數(shù)列為1,4,從數(shù)值1所在位置開(kāi)始計(jì)數(shù)第三輪計(jì)數(shù)出列數(shù)字為1,計(jì)數(shù)值更新m=1,出列后數(shù)列為4,從數(shù)值4所在位置開(kāi)始計(jì)數(shù)最后一輪計(jì)數(shù)出列數(shù)字為4,計(jì)數(shù)過(guò)程完成。輸出數(shù)值出列順序?yàn)椋?,3,1,4。

要求實(shí)現(xiàn)函數(shù):

voidarray_iterate(intlen,intinput_array[],intm,intoutput_array[])【輸入】intlen:輸入數(shù)列的長(zhǎng)度;intintput_array[]:輸入的初始數(shù)列intm:初始計(jì)數(shù)值

【輸出】intoutput_array[]:輸出的數(shù)值出列順序【返回】無(wú)示例

輸入:intinput_array[]={3,1,2,4},intlen=4,m=7輸出:output_array[]={2,3,1,4}

////////////循環(huán)鏈表實(shí)現(xiàn)//////////////////////#include#include#includetypedefstructNode{

intnum;

structNode*next;}node;

node*creat(intlen,intinput_array[]){

node*h,*s,*p;inti;

h=(node*)malloc(sizeof(node));h->num=input_array[0];p=h;

for(i=1;inum=input_array[i];p->next=s;p=s;}

p->next=h;

return(h);}

voidarray_iterate(intlen,intinput_array[],intm){

node*q,*p,*s;inti=0,j=0,k;

intoutput_array[4];

p=creat(len,input_array);while(p->next!=p){

for(i=1;inext;}

m=p->num;

//printf("%5d",m);output_array[j++]=m;s=p;

q->next=p->next;p=p->next;free(s);s=NULL;}

m=p->num;

//printf("%5d\\n",m);output_array[j]=p->num;k=j;

for(j=0;j

#include#include#include#include#defineLENGTH13

intverifyMsisdn(char*inMsisdn){

char*pchar=NULL;

assert(inMsisdn!=NULL);

if(LENGTH==strlen(inMsisdn)){

if(("8"==*inMsisdn)&&(*(inMsisdn+1)=="6")){

while(*inMsisdn!="\\0"){

if((*inMsisdn>="0")&&(*inMsisdn}

7、數(shù)組比較(20分)(和第4、12題一樣)問(wèn)題描述:

比較兩個(gè)數(shù)組,要求從數(shù)組最后一個(gè)元素開(kāi)始逐個(gè)元素向前比較,如果2個(gè)數(shù)組長(zhǎng)度不等,則只比較較短長(zhǎng)度數(shù)組個(gè)數(shù)元素。請(qǐng)編程實(shí)現(xiàn)上述比較,并返回比較中發(fā)現(xiàn)的不相等元素的個(gè)數(shù)比如:

數(shù)組{1,3,5}和數(shù)組{77,21,1,3,5}按題述要求比較,不相等元素個(gè)數(shù)為0數(shù)組{1,3,5}和數(shù)組{77,21,1,3,5,7}按題述要求比較,不相等元素個(gè)數(shù)為3

要求實(shí)現(xiàn)函數(shù):

intarray_compare(intlen1,intarray1[],intlen2,intarray2[])

【輸入】intlen1:輸入被比較數(shù)組1的元素個(gè)數(shù);intarray1[]:輸入被比較數(shù)組1;

intlen2:輸入被比較數(shù)組2的元素個(gè)數(shù);intarray2[]:輸入被比較數(shù)組2;【輸出】無(wú)

【返回】不相等元素的個(gè)數(shù),類(lèi)型為int

示例

1)輸入:intarray1[]={1,3,5},intlen1=3,intarray2[]={77,21,1,3,5},intlen2=5函數(shù)返回:02)輸入:intarray1[]={1,3,5},intlen1=3,intarray2[]={77,21,1,3,5,7},intlen2=6函數(shù)返回:3

#include#include#include

intarray_compare(intlen1,intarray1[],intlen2,intarray2[]){

intcount=0;

for(;len1>0&&len2>0;len1--,len2--){

if(array1[len1-1]!=array2[len2-1]){

count++;}}

returncount;}

intmain(){

intresult=0;

intarray1[]={1,3,5};intlen1=3;

intarray2[]={77,12,1,3,5,7};intlen2=6;

result=array_compare(len1,array1,len2,array2);

///result=array_compare(len1,array1[],len2,array2[]);不能這樣

//函數(shù)形參中永遠(yuǎn)只是傳得首地址,不能傳數(shù)組切記切記!。。。!printf("theresultis%d",result);}

8、簡(jiǎn)單四則運(yùn)算

問(wèn)題描述:輸入一個(gè)只包含個(gè)位數(shù)字的簡(jiǎn)單四則運(yùn)算表達(dá)式字符串,計(jì)算該表達(dá)式的值注:1、表達(dá)式只含+,-,*,/四則運(yùn)算符,不含括號(hào)

2、表達(dá)式數(shù)值只包含個(gè)位整數(shù)(0-9),且不會(huì)出現(xiàn)0作為除數(shù)的情況3、要考慮加減乘除按通常四則運(yùn)算規(guī)定的計(jì)算優(yōu)先級(jí)

4、除法用整數(shù)除法,即僅保留除法運(yùn)算結(jié)果的整數(shù)部分。比如8/3=2。輸入表達(dá)式保證無(wú)0作為除數(shù)情況發(fā)生

5、輸入字符串一定是符合題意合法的表達(dá)式,其中只包括數(shù)字字符和四則運(yùn)算符字符,除此之外不含其它任何字符,不會(huì)出現(xiàn)計(jì)算溢出情況要求實(shí)現(xiàn)函數(shù):

intcalculate(intlen,char*expStr)【輸入】intlen:字符串長(zhǎng)度;char*expStr:表達(dá)式字符串;【輸出】無(wú)

【返回】計(jì)算結(jié)果

示例

1)輸入:char*expStr=“1+4*5-8/3”函數(shù)返回:19

2)輸入:char*expStr=“8/3*3”函數(shù)返回:6#include#includeusingnamespacestd;

intcalculate(intlen,char*expStr){

struct{

charopdata[200];inttop;

}opstack;//定義操作符棧opstack.top=-1;

inti=0;//遍歷字符串的下標(biāo)intt=0;//當(dāng)前后綴表達(dá)式的長(zhǎng)度charch=expStr[i];while(ch!="\\0"){switch(ch){case"+":case"-":while(opstack.top!=-1){expStr[t]=opstack.opdata[opstack.top];opstack.top--;t++;

}

opstack.top++;

opstack.opdata[opstack.top]=ch;

break;

case"*":

case"/":

while(opstack.top!=-1&&(opstack.opdata[opstack.top]=="*"||opstack.opdata[opstack.top]=="/")){expStr[t]=opstack.opdata[opstack.top];opstack.top--;

t++;

}}}

opstack.top++;

opstack.opdata[opstack.top]=ch;break;

default:

expStr[t]=ch;t++;break;

i++;

ch=expStr[i];

while(opstack.top!=-1)//將棧中所有的剩余的運(yùn)算符出棧{

expStr[t]=opstack.opdata[opstack.top];}

expStr[t]="\\0";struct

{

opstack.top--;t++;

intnumeric[200];inttop;

}data;

data.top=-1;i=0;

ch=expStr[i];

while(ch!="\\0"){if(ch>="0"&&ch

}{}

inttmp=data.numeric[data.top-1]/data.numeric[data.top];data.top--;

data.numeric[data.top]=tmp;

printf("cannotbezeroofthedivide\\n");exit(1);

i++;

ch=expStr[i];

}}

voidmain(){

charexpStr[]="9/3*5";returndata.numeric[data.top];

printf("%s\\n",expStr);}

9、選秀節(jié)目打分,分為專(zhuān)家評(píng)委和大眾評(píng)委,score[]數(shù)組里面存儲(chǔ)每個(gè)評(píng)委打的分?jǐn)?shù),judge_type[]里存儲(chǔ)與score[]數(shù)組對(duì)應(yīng)的評(píng)委類(lèi)別,judge_type[i]==1,表示專(zhuān)家評(píng)委,judge_type[i]==2,表示大眾評(píng)委,n表示評(píng)委總數(shù)。打分規(guī)則如下:專(zhuān)家評(píng)委和大眾評(píng)委的分?jǐn)?shù)先分別取一個(gè)平均分(平均分取整),然后,總分=專(zhuān)家評(píng)委平均分*0.6+大眾評(píng)委*0.4,總分取整。如果沒(méi)有大眾評(píng)委,則總分=專(zhuān)家評(píng)委平均分,總分取整。函數(shù)最終返回選手得分。函數(shù)接口intcal_score(intscore[],intjudge_type[],intn)#include#include#include#include#defineN5

intresult=calculate(strlen(expStr),expStr);printf("%d\\n",result);

intcal_score(intscore[],intjudge_type[],intn){

intexpert=0;intdazhong=0;intzongfen=0;inti;

intnumber=0;

for(i=0;i例如:input[]={3,6,1,9,7}output[]={3,7,9,6,1};input[]={3,6,1,9,7,8}output[]={1,6,8,9,7,3}#include#include#include

voidsort(intinput[],intn,intoutput[]){

inti,j;intk=1;inttemp;intmed;

for(i=0;iintmain(){

inta[6]={3,6,1,9,7,8};intb[6]={0};

for(inti=0;i=50且{

system_task[j]=task[i];pp[j]=i;j++;}

count=j;}

elseif(task[i]

for(i=0;i//把兩數(shù)組倒置

for(i=0;i{

length++;

}

printf(“Thelengthofstringis%d\\n”,length);return0;

}

14、使用C語(yǔ)言實(shí)現(xiàn)字符串中子字符串的替換

描述:編寫(xiě)一個(gè)字符串替換函數(shù),如函數(shù)名為StrReplace(char*strSrc,char*strFind,char*strReplace),strSrc為原字符串,strFind是待替換的字符串,strReplace為替換字符串。舉個(gè)直觀的例子吧,如:“ABCDEFGHIJKLMNOPQRSTUVWXYZ”這個(gè)字符串,把其中的“RST”替換為“ggg”這個(gè)字符串,結(jié)果就變成了:ABCDEFGHIJKLMNOPQgggUVWXYZ答案一:

#include#include

voidStrReplace(char*strSrc,char*strFind,char*strReplace);#defineM100;voidmain()

{chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";chars1[]="RST";chars2[]="ggg";

StrReplace(s,s1,s2);printf("%s\\n",s);}

voidStrReplace(char*strSrc,char*strFind,char*strReplace){

inti=0;intj;

intn=strlen(strSrc);intk=strlen(strFind);for(i=0;ifor(;*s;s++){

for(p=s1;*p&&*p!=*s;p++);if(*p)*s=*(p-s1+s2);}}

intmain(){

chars[MAX];//s是原字符串chars1[MAX],s2[MAX];//s1是要替換的//s2是替換字符串puts("Pleaseinputthestringfors:");scanf("%s",s);

puts("Pleaseinputthestringfors1:");scanf("%s",s1);

puts("Pleaseinputthestringfors2:");scanf("%s",s2);

StrReplace(s,s1,s2);

puts("Thestringofsafterdisplaceis:");printf("%s\\n",s);return0;}

答案三:

#include#include#include#defineM100

voidStrReplace(char*strSrc,char*strFind,char*strReplace);intmain(){

chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";chars1[]="RST";chars2[]="gggg";StrReplace(s,s1,s2);printf("%s\\n",s);return0;}

voidStrReplace(char*strSrc,char*strFind,char*strReplace){

while(*strSrc!="\\0"){

if(*strSrc==*strFind){

if(strncmp(strSrc,strFind,strlen(strFind))==0){

inti=strlen(strFind);intj=strlen(strReplace);printf("i=%d,j=%d\\n",i,j);char*q=strSrc+i;printf("*q=%s\\n",q);

while((*strSrc++=*strReplace++)!="\\0");printf("strSrc-1=%s\\n",strSrc-1);printf("*q=%s\\n",q);

while((*strSrc++=*q++)!="\\0");}else{

strSrc++;}}else{

strSrc++;}}}

15、編寫(xiě)一個(gè)程序?qū)崿F(xiàn)功能:將字符串”ComputerSecience”賦給一個(gè)字符數(shù)組,然后從第一個(gè)字母開(kāi)始間隔的輸出該串,用指針完成。答案:

#include#includeintmain(){

charstr[]=”ComputerScience”;intflag=1;char*p=str;while(*p)

{

if(flag){

printf(“%c”,*p);}

flag=(flag+1)%2;p++;}

printf(“\\n”);return0;}16、(和第14題一樣)使用C語(yǔ)言實(shí)現(xiàn)字符串中子字符串的替換

描述:編寫(xiě)一個(gè)字符串替換函數(shù),如函數(shù)名為StrReplace(char*strSrc,char*strFind,char*strReplace),strSrc為原字符串,strFind是待替換的字符串,strReplace為替換字符串。舉個(gè)直觀的例子吧,如:“ABCDEFGHIJKLMNOPQRSTUVWXYZ”這個(gè)字符串,把其中的“RST”替換為“ggg”這個(gè)字符串,結(jié)果就變成了:ABCDEFGHIJKLMNOPQgggUVWXYZ答案一:

#include#include

voidStrReplace(char*strSrc,char*strFind,char*strReplace);#defineM100;voidmain()

{chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";chars1[]="RST";chars2[]="ggg";

StrReplace(s,s1,s2);printf("%s\\n",s);}

voidStrReplace(char*strSrc,char*strFind,char*strReplace){

inti=0;intj;

intn=strlen(strSrc);intk=strlen(strFind);for(i=0;ireturn0;}

答案三:

#include#include#include#defineM100

voidStrReplace(char*strSrc,char*strFind,char*strReplace);intmain(){

chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";chars1[]="RST";chars2[]="gggg";

StrReplace(s,s1,s2);printf("%s\\n",s);

return0;}

voidStrReplace(char*strSrc,char*strFind,char*strReplace){

while(*strSrc!="\\0"){

if(*strSrc==*strFind){

if(strncmp(strSrc,strFind,strlen(strFind))==0){

inti=strlen(strFind);intj=strlen(strReplace);printf("i=%d,j=%d\\n",i,j);char*q=strSrc+i;printf("*q=%s\\n",q);

while((*strSrc++=*strReplace++)!="\\0");printf("strSrc-1=%s\\n",strSrc-1);printf("*q=%s\\n",q);

while((*strSrc++=*q++)!="\\0");}else{

strSrc++;}}else{

strSrc++;}}}

17、編寫(xiě)一個(gè)程序?qū)崿F(xiàn)功能:將兩個(gè)字符串合并為一個(gè)字符串并且輸出,用指針實(shí)現(xiàn)。

charstr1[20]={“Hello”},str2[20]={“World”};答案:

#include

intmain(){

charstr1[20]={“Hello”},str2[20]={“World”};char*p=str1,*q=str2;

while(*p)p++;while(*q){

*p=*q;p++;q++;}

*p=‘\\0’;

printf(“%s\\n”,str1);

return0;}

18、算分?jǐn)?shù)的問(wèn)題,去掉一個(gè)最高分一個(gè)最低分,求平均分

1.#include

2.floatavescore(floatscore[],intn)3.{

4.floatmin=0;5.floatmax=0;6.intminindex=0;7.intmaxindex=0;8.floatsum=0;9.min=score[0];

10.for(inti=0;i30.voidmain()31.{

32.floatscore[6]={70,80,90,98,87,86};33.floatlastscore;

34.lastscore=avescore(score,6);

35.printf("thelastscoreis:%5.2f\\n",lastscore);36.37.}運(yùn)行結(jié)果:

thelastscoreis:85.75

19、對(duì)一個(gè)數(shù)組,將數(shù)組中偶數(shù)從大到小排序,奇數(shù)從小到大排序,奇數(shù)和偶數(shù)交叉著放且輸出數(shù)組第一位放奇數(shù)若奇數(shù)和偶數(shù)不等長(zhǎng),則把剩下的直接放到數(shù)組中。

思路:先進(jìn)行奇偶判斷,得到奇數(shù)和偶數(shù)數(shù)組。然后對(duì)兩數(shù)組排序,進(jìn)行長(zhǎng)度判斷,最后組織數(shù)據(jù)。

#include

1.#include2.

3.voidjiou(inta[],intn)4.{

5.int*p1;6.int*p2;7.inti,j;8.intk=0;9.intkk=0;

10.intcount1=0;11.intcount2=0;12.inttemp;13.inttemp2;14.intm=0;

15.p1=(int*)malloc(sizeof(int)*n);16.p2=(int*)malloc(sizeof(int)*n);17.for(i=0;i37.38.39.40.41.42.43.44.45.46.47.48.

for(i=0;i87.for(i=0;iif(*(inID+i)"9")return2;}

if(*(inID+17)"9")if(*(inID+17)!="x")return3;

chartemp1[10]={0};chartemp2[10]={0};chartemp3[10]={0};

memcpy(temp1,inID+6,4);intyear=atoi(temp1);

if(year2100)return4;

memcpy(temp2,inID+10,2);intmon=atoi(temp2);if(mon12)return5;

memcpy(temp3,inID+12,2);intday=atoi(temp3);

if(1==mon){

if(day31)return6;}

if(2==mon)//能被4整除且不能被100整除或能被400整除的年份,閏年的2月份為29天,非閏年的2月份為28天。{

if(((year%4==0)&&(year%100!=0))||(year%400==0)){

if(day29)return6;}else{

if(day28)return6;}}

if(3==mon){

if(day31)return6;}

if(4==mon){if(day30)return6;}

if(5==mon){

if(day31)return6;}

if(6==mon){

if(day30)return6;}

if(7==mon){

if(day31)return6;}

if(8==mon){

if(day31)return6;}

if(9==mon){

if(day30)return6;}

if(10==mon){

if(day31)return6;}

if(11==mon){

if(day30)return6;}

if(12==mon){

if(day31)return6;}

return0;}

voidmain(){

charbuf[20]="500106198701295410";intre=verifyID(buf);printf("re=%d\\n",re);printf("\\n");}

21.手機(jī)號(hào)碼合法性問(wèn)題的另一個(gè)版本/*1.手機(jī)號(hào)碼合法性判斷(20分)問(wèn)題描述:

我國(guó)大陸運(yùn)營(yíng)商的手機(jī)號(hào)碼標(biāo)準(zhǔn)格式為:國(guó)家碼+手機(jī)號(hào)碼,例如:8613912345678。特點(diǎn)如下:1、長(zhǎng)度13位;

2、以86的國(guó)家碼打頭;

3、手機(jī)號(hào)碼的每一位都是數(shù)字。

請(qǐng)實(shí)現(xiàn)手機(jī)號(hào)碼合法性判斷的函數(shù)(注:考生無(wú)需關(guān)注手機(jī)號(hào)碼的真實(shí)性,也就是說(shuō)諸如86123123456789這樣的手機(jī)號(hào)碼,我們也認(rèn)為是合法的),要求:1)如果手機(jī)號(hào)碼合法,返回0;

2)如果手機(jī)號(hào)碼長(zhǎng)度不合法,返回1

3)如果手機(jī)號(hào)碼中包含非數(shù)字的字符,返回2;4)如果手機(jī)號(hào)碼不是以86打頭的,返回3;

【注】除成功的情況外,以上其他合法性判斷的優(yōu)先級(jí)依次降低。也就是說(shuō),如果判斷出長(zhǎng)度不合法,直接返回1即可,不需要再做其他合法性判斷。要求實(shí)現(xiàn)函數(shù):

intverifyMsisdn(char*inMsisdn)

【輸入】char*inMsisdn,表示輸入的手機(jī)號(hào)碼字符串【輸出】無(wú)【返回】判斷的結(jié)果,類(lèi)型為int。示例

輸入:inMsisdn=“869123456789“輸出:無(wú)返回:1

輸入:inMsisdn=“88139123456789“輸出:無(wú)返回:3

輸入:inMsisdn=“86139123456789“輸出:無(wú)返回:0*/

#include#include

intverifyMsisdn(char*inMsisdn){

intlen=strlen(inMsisdn);inti=0;if(len!=13)return1;

for(i=0;ireturn0;else

return3;}

voidmain(){

intre=verifyMsisdn("861A640503228");printf("re=%d\\n",re);}

友情提示:本文中關(guān)于《PPTV_201*校園招聘研發(fā)類(lèi)筆試題》給出的范例僅供您參考拓展思維使用,PPTV_201*校園招聘研發(fā)類(lèi)筆試題:該篇文章建議您自主創(chuàng)作。

來(lái)源:網(wǎng)絡(luò)整理 免責(zé)聲明:本文僅限學(xué)習(xí)分享,如產(chǎn)生版權(quán)問(wèn)題,請(qǐng)聯(lián)系我們及時(shí)刪除。


PPTV_201*校園招聘研發(fā)類(lèi)筆試題》由互聯(lián)網(wǎng)用戶整理提供,轉(zhuǎn)載分享請(qǐng)保留原作者信息,謝謝!
鏈接地址:http://www.seogis.com/gongwen/664768.html
相關(guān)文章