华为上机笔试_第1页
华为上机笔试_第2页
华为上机笔试_第3页
华为上机笔试_第4页
华为上机笔试_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

本文格式为Word版,下载可任意编辑——华为上机笔试

//报数问题.cpp:定义控制台应用程序的入口点。//

#include\#includeusingnamespacestd;

structCYCLE{intnum;structCYCLE*next;};

voidcircle_sort(intn,ints,intm,int*p){structCYCLE*people=(CYCLE*)malloc(sizeof(CYCLE));structCYCLE*head=people;//头部people->num=1;//intj=1;intt=m;inta=0;//记录输出个数//初始化;for(intj=2;jnum=j;people->next=temp;people=people->next;}people->next=head;//循环链表head=people->next;while(people->num!=s){people=people->next;}

while(a1){people=people->next;}//deletestructCYCLE*ttt=people->next;p[a]=ttt->num;a++;people->next=ttt->next;delete(ttt);people=people->next;t=m;}}

intmain(intargc,char*argv[]){inta[7]={0};int*p=a;intn=3;ints=1;intm=2;circle_sort(n,s,m,p);for(inti=0;is;return0;}

//字串查找.cpp#include\#include

intstrlen(char*p){}

unsignedintstr_str(char*src,char*dst){

intlen_src=0;intlen_dst=0;intj=0;inti=0;

len_src=strlen(src);len_dst=strlen(dst);

if(len_src

voidcount(constchar*input,unsignedint*letters,unsignedint*numbers,unsignedint*blanks,unsignedint*others){

inti=0;

}

while(input[i]!='\\0'){}

if(input[i]>=65elseif(input[i]>=97elseif(input[i]>=48elseif(input[i]==32)(*blanks)++;else(*others)++;i++;

voidmain(){}

constchar*input=\;unsignedinti=0;unsignedintj=0;unsignedintm=0;unsignedintn=0;unsignedint*letters=unsignedint*numbers=unsignedint*blanks=unsignedint*others=

count(input,letters,numbers,blanks,others);

printf(\,*letters,*numbers,*blanks,scanf(\,*numbers);

*others);

//数制转换.cpp:定义控制台应用程序的入口点。

#include

voidDecToBin(unsignedintiDec,charpBin[32]){

}

unsignedinti;pBin[32]='\\0';i=31;while(iDec){}

pBin[i]=iDec%2+'0';iDec=iDec/2;i--;

voidmain(){}

unsignedintdec=8;charpBin[32];

for(inti=0;i

intisWorking(unsignedintyear,unsignedintmonth,unsignedintday){

if(year12||month31){printf(\);return

-1;}/*}

voidmain(){

unsignedintyear,month,day;

intsumDays=sum_year_Days+sum_month_Days+day;intresult=sumDays%5;

if(result>=1elsereturn0;switch(month){}

if((year@0==0||(year%4==0*/

intmonth_day[]={31,28,31,30,31,30,31,31,30,31,30,31};if(year@0==0||(year%4==0for(inti=0;i#includeusingnamespacestd;

#defineSIZE10typedefcharelem1;typedefintelem2;

elem1optr[SIZE];elem2opnum[SIZE];inttop1,top2;

voidInitstack(elem1e1){}

voidInitstack(elem2e2){}

voidpush(elem1*e1,elem1x){}

voidpush(elem2*e2,elem2x){}

voidpop(elem1*e1,elem1charc;

while(*exp!='\\0'){

if(*exp>='0'push(opnum,t);}else

switch(*exp){

case'+':push(optr,*exp);break;

x=*e-'0';x=e2[top2-1];x=e1[top1-1];x=e2[--top2];x=e1[--top1];e2[top2++]=x;e1[top1++]=x;top2=0;top1=0;

}

}

}

case'-':push(optr,*exp);break;

case'*':pop(opnum,temp);getnum(++exp,t);push(opnum,temp*t);break;case'/':pop(opnum,temp);getnum(++exp,t);push(opnum,temp/t);break;

exp++;

while(top1!=0){}

pop(opnum,temp);returntemp;

pop(optr,c);switch(c){}

case'+':pop(opnum,temp);pop(opnum,t);push(opnum,temp+t);break;case'-':pop(opnum,temp);pop(opnum,t);push(opnum,t-temp);break;

intmain(){}

char*c=\;intlen=9;

intt=calculate(len,c);cout>t;return0;

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论