程序员笔试真题A、该题用语言描述是指:第i行第一个输出*,然后输出i- 1个.,重复上i次。#i ncl ude#def i neN8i ntmai n( ){i nti ;i ntj ;i ntk;for ( i =0; i 2){n- =1;next _ol der _r esul t =pr evi ous_r esul t +r esul t ;pr evi ous_r esul t =r esul t ;resul t =next _ol der _r esul t ;}ret ur nresul t ;}D、源程序如下,红笔写出的是修改的地方:(其实这个程序有好多漏洞,不知为什么会那这个程序来考)#i ncl ude#i ncl udet ypedefst r uct {TNode*lef t ;TNode*ri ght ;i ntval ue;}TNode;TNode*root =NULL;voi dappend( i ntN) ;i ntmai n( ){append( 63) ;append( 45) ;append( 32) ;append( 77) ;append( 96) ;append( 21) ;append( 17) ;//Agai n,数字任意给出}voi dappend( i ntN){TNode*NewNode=( TNode*) mal l oc( si zeof ( TNode) ) ;NewNode- >val ue=N;NewNode- >r i ght =NULL;NewNode- >l ef t =NULL;i f ( r oot ==NULL){root =NewNode;ret ur n;}el se{TNode*temp;t emp=r oot ;whi l e( ( N>=t emp. val uet emp. l ef t !
程序员笔试真题 来自淘豆网m.daumloan.com转载请标明出处.