C語(yǔ)言程序設(shè)計(jì)蘇小紅版答案_第1頁(yè)
C語(yǔ)言程序設(shè)計(jì)蘇小紅版答案_第2頁(yè)
C語(yǔ)言程序設(shè)計(jì)蘇小紅版答案_第3頁(yè)
C語(yǔ)言程序設(shè)計(jì)蘇小紅版答案_第4頁(yè)
C語(yǔ)言程序設(shè)計(jì)蘇小紅版答案_第5頁(yè)
已閱讀5頁(yè),還剩32頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、2 2 #i ncludeVst dio hmai n ()fl o a t x =2、5, y=2、5,z=2、5; oprintf(Hx=% f nH,x );P rint f Cy=% f nM, y);p rint f (,z=%fn,z);3、1(1)#in c ludcvs t d i o、hinain()4nt a=12,b= 3 ;f Io a t x=18、5 ,y=4、6 ;p rintf (H%d n M , ( f loat)(a *b) / 2); p r intf (吆 d nM, (i n t ) x %(int) y ): )3、2# i n clud e in

2、ain()4nt x,bO, b l.b2,s;printf(HInput x :”); oscanf(H%du, &x): ob2=x / 100;b 1 =(x-b2*l 0 0) / 1 0 ;bO=x%l 0 :s=bO* 1 00+bl* 1 0+b2;print f(Hs=%dns);3、3 #i n c lud e h#inc I ud e Vmath、hmai n ()oflo a t rate=O 0225;flo a t n,c a p itaL deposit;p rintf(HI n p ut n,capital:); s canf(H%f,%f11,&n,&capit

3、al);deposit=capit a l*p o w(l+rate, n): printf(Hdepos i t=%fnu, deposi t);3、4 #incl u d e #in c lude hni a i n ()f lo a t a, b,c;。d o u b 1 e x,y;op r intf(M I nputa.b, c: M );oscan ff,% f H,&a.&b.&c):x=(- b +sqr t (b*b-4*a*c) / (2*a); y= (-b s qrt ( b *b-4*a*c) /(2*a);op r intf(u x =%f, y=% f n M ,

4、x, y);4、1(1)# i ncludema i n()char cl=af ,c2= b,c3c:oprin t f(a% c b%cc%cn cl,c 2 ,c 3);4、1(2) #inc I udemain ()4nt a=l 2 , b=15;oprintf ( M a=%d%, b=%d% n ”a b); 4、1(3) #in c lu d emain()4nt a, b ;s canf (,%2d%*2s%2d,&a, &b);printfC%d.%dnuAb):4、2 Wind u demain()Ion g a, b ;f loat x, y;sc a nf( H %d

5、, %dn ”,&a,&b);昭 c a n f (M%f,%fn 11,& x,&y); pr i nt f (Ma=% d ,b=% d n ab);opr i ntfC x=%f,b=%fn,x,y);5、1 #i n c ludema i n ()flo a t a;printf(H I impul a : M);scanf( Mi f ( a = 0 )a= a :a print f C a =%A n H,a);else0 o a=-a;p r intf( a =%fn a );5、2 #in c ludemain()i nt a;。p rin t f(N 1 nputa: H):

6、巧 c anf C% d &a);oif(a%2=0)。p rintf(H a 就是偶數(shù));e Is egp r in t f( u a 就是奇數(shù)”);5、3#inclu d e#incl u d e main()afloat a , b, c ,s, area;printf ( M I nputa,b.c: M);os c anf(H% f 9%f9%r9& a ,&b, &c);4 f (a+bc&a+cb&b+ca)B s= (a+b+c) / 2;area=(fl o at) sqrt(s*( s -a)*(s-b) *(s c );a p ri n if (”a r ea=%fnMi

7、 a r ea);else。printf (不就是三角形);5、4 #in c lude #incl u dem a i n()fl o at a.b.c,x,y:)prin t f (uInputa,bx:M);osc a nf( H % f ,%f, %化& a , &b,&c);i f (a=0)print f (%亥方程不就是一元二次方程i f(b*b-4*a*c0)a x= (-b+sqrt(b * b- 4 *a* c ) ) / (2 * a):y=(b-sqrt ( b *b-4 *a*c)/(2*a);pri n t f ( * x =%f,y=%f n M ,x,y);el

8、se if(b*b4* a *c=0)oox=-b/(2*a);y= b/(2* a );-print f(Hx=%fy=%f n x ,y);。e 1 s epri ntf(”該方程無(wú)實(shí)根n”);5、5#incl u d emain()4nt yea r.fla g ;p r i n tf(HI 叩 u t a year:”);a s canf(M%d ,&y e ar);。i f (year % 4=0&y e ar%4 0 0! =0lly e ar% 4 00=0) gf 1 ag =1;e Ise0 flag=O:oif(flag=l)。p rint f (H%d is a leap

9、 year !n”,y ear );elseprin t f(n%d i s n ot a leap year !n H ,yca r );5、6 #i ncl udcVs t dio. hmain()i n t ye a r, flag:printf( * Input a y e ar:H):s c an f ( H %d .&yca r);f 1 ag=yea r%4 0 0 =0llyear%4=0&year% 100!=0? 1 :0;i f (flag= 1 &fl a g!=0)oopri n tf( * % d i s a leap ye a r !nH year);e 1 se

10、oprin tf( * %d is not a leap yea r !nyear);5、7 #includema i n()ch a r ch;pr i nt f (HI n pu t ch:”):s canf ( * %c”,&ch);4f( c h=,a, &ch=A&ch=,Z,)g c h=g e tchar();xch=ch+ 3 2;a p r int fd nM, ch, c h);町oelsepr i ntf(n%cch):5 8 #includemain()ch a r c h;p r in t f ( M Inpu t ch:M): s c an f (” %cl&c h

11、 );o i f(ch= 4 8 &ch= 6 5 & c h= 9 7 & & ch= 122)ap rintf( ” ch就是小寫(xiě)字母nn):0 qe Ise if(ch=3 2 )aP ri n tf(Hch 就是空格n ” ):oooo else。-prin t f( ” ch就是其她字符 n ,r);oooo J J5 9 #incl u demain ()nt scor e,grade;p r i nt f (* I n put score:*);“sc a nf (H%d*&s c ore):。 g rade=sco r e / 1 0 ;4 f (sc o re 1 0 0)a

12、 p r i n t f (u I n put e rror n *);i f (score =9 0 &score=80&sc o re=7 0& s cor e = 6 0& s core=0& s c o re6 0 )。 printf( * %d- -EXifsc ore);。5、10 #includemai n ()int y ea r .month:p r i n tf(HInput y ear.mont h :”); scanf ( M % d”, & year, & m o nth);i f (month12l I m o n th=0)pri n tf( M err o r

13、m o n t h n );町elseosw i t c h (yean mont h )case 12:ma s e 10:case 8 :oc a se 7:ncasc 5 :case 3:case 1 :即 i ntf(M31 天n”);a obrea k;。c asc 1 1 :was e 9:oca s e 6 :case 4 :gpr i nt f (H30 天n );brea k ;總 s c 2 ”。ifif (y(y e e ar%4HH0&ycar%4HH0&Hc9Hcs )e e lsclscg g p p r r iHfviHfv 2 2 8Hn8Hn)八丄O O ob

14、reobre a a k k - -defau 一rrrro o prpr i i n【f(=In【f(=I n n pupu r r CITOrwCITOrw X X6 1(1)sncmd e c s t: dio hv main()宀in 二.j.j .?T.?T o o c c haha r r spacellrspacellr uforufor (iurriAH4(iurriAH4 i+)i+)gforoH 1 “A-Hr j +)。oprinif (敘 cspace)八。-。 for(kHrrkc=6 八 k +)二printf( ; = K丄。 P 2二 H -丄)6 1 (2)

15、* i nccd CASai o hvmain ()宀iHk 4.=?f or ( n H 0 mArn+)(i f (2 0 ) con t i n Uno k;八op r i n 一 f(二 kH/d / n 三“忍 d / n Jrn)“6 1 (3) # i nclud e main ()i nt k= 4 , n ;f or(n=0; n k : n+)if(n%2=0) break;町叩 r intf(,rk=%d,n=% d n M kn);6、2( 1 ) #incl u demai n ()int i , s um=0;ofor(i= 1 ;i 2(2) # i ncl u

16、d cvstdio、h mai n ()4 o ng i :a 1 ong temr s um=0;ofor(i=l: i=l 0 1; i= i +2) 彳a t erm=i*( i +l)*(i+2);a s um=sum+t erm;oprintf(Msum=%Id n sum);6、2(4) #in c 1 ud e # inclu d e inain()int n=l:f 1 o at term=k O,sign=l,sum=O; wh i le(term=Ie4)tcrm=l、0/sign;oosum=sum+ ter m;sign=sign+ n ;ofl+十; oprintf(

17、Hsuin=%fn M ,sum);)6、2(5) #in c lude#inc 1 u demain()。i n t n=l count=l;afloat x :d o u b le sum, t erm;opr i n t f ( H I nput x:H):scan” f H , &x);sum=x;4erm=x;=le-5);P r i n tf(H s in(x ) =%f, c ount=%d nN,sum,count);6、3# i nclud e mai n ()i nt x=l,find= 0 ;whil e (!fi nd)i f (x%2= = l&x%3=2 &x%5=

18、4&x%6= 5 & x %7=0)0 aprintf(nx=%dnH, x);gfind=l;nX+:oo J/ *4nt x fi n d =0;。f or ( x =1: Ifind; x+)彳oif(x%2=l& x %3=2& x%5 =4&x%6=5 &x% 7 =0)pr i n t f(Hx=%dnH,x);fin d =1;*/6、4# i n c lud e vst d i o、hmain ()inti, n:dong p=l,m = l;sprint f (M In p u t n:H);oscanf (H%dH,&n);for (i= 1 ;i=n; i +)。ap=i

19、 * i; p r i ntf(Mp=%djn=%dnM,i?p4, )6、5 #incl u dema i n()afl o a t c , f :f or(c=-40;c= 110; c = c +10)f=9/5*c + 3 2;-printf ( H f=%fn”,f);6、6# i nclude#includ e main ()4n t n:o ub 1 c c= 0 x 0187 5 ,x;兄0o x= x * p o w( 1 +c,12) -1 000; m+; wh i le(x0);printf(Mx=%d n M ,x);6、7 #incl u demai n ()i n

20、 t n=0;flo a t a= 1 00、0 ,c;oprintf CT n put c :H);o s c a n f C%化 &c);do豳=a *( 1 +c);c ount)on +; while (a=200);o p rin t f(*n=%dn *n);6、8#in c lu d eWind u dema i n ()4n t n=l,c o u nt= 1;doubl e sum= 1, t erm=l;whi 1 e(fabs(t e rm)=le-5)ooterm= p ow ( 1, co u n t)*( 1 x 0 / (n+2): su m= s um+te r

21、 m;“ n=n+ 2 ;o co u nt+ + :sum= 4 *sum;p r i n tf(onsum=%f, count=%dn sum, 6、9 #inc 1 ude#includ e main()4nt n= 1 ,count=l;d o ub I e s u m=l, term=l;w h ile(fabs ( t e rm)=le-5)4erm=terni *( 1、0 /n);sum=sum+ternKn+;x?oun t+;printf(,sum=%f, c o u nt=% d n,sum,coun t ):6、10 #i nc 1 u d e h# i ncl ude

22、Vmath、hmai n ()o i n t x :o f or ( x=l 0 0;x=9 9 9: x+)0 gjf (x=po w (x / 1 00, 3 )+ p o w( x/10%10, 3)+pow (x%l 0 3) prin t f(Hx=% d n ”,x );6、11 #i n c 1 u demai n ()a i nt i=0.n;4 o ng s um= 0 ,tenn=l;p rintfCI n p u tn:H);osc a nf (&n):doY+;。t c r m= t erm*i;s um= s um+term:w h ile(summ a in()in

23、t i,n m,co u nt=0.sum=0;opr i nt f (MIn p ut n :”);s c a n f (M %d*&n):oofor(i= 1 : i0)o oooou m=sum+m:c o unt+;oooooo 。 el s e。r e a k ;oooo p ri n tf (”sum=%d count=%dn, sum, c ount): J)61 3 #in c ludema i n ()in t ijLmxou n t =0,sum=0; printfCInputn:11);oscanf(H%d&n);f or(i=l;iV=n;i+ + )o pr i n

24、t f(* I n psea nf(”d”,&m);if(m0llm0)oo asum=sum+m;acount+十;aa e 1 sezbreak:oo J。 p rintf(Hsum=%dxoun t =%d n ”,s um,count);6、1 4# inc ludem a in()nt x, y , z;4b r (x=0: x=17; x +)f o r ( y =0;yma i n ()。i nix, y;of o r(x=0;x=98; x +)a y=98-x;2*x+4 *y=3 86;if(x+ y =98 & & 2*x+4* y=38 6 )ooooprintf(Hx

25、=%d.y=%d F,x,y);0 6、16#includ e hmai n ()i n t x,y, z :4o r (x=O;x 1 7# i n cludemain ()4nt xy z ;f o r (x= 1 ;x=9: x+)ofo r(y= 1 ;y0)。 o pri n tf( x=% d ,y=%d, z=%dn, x, y,z);0 o o joojoo7、1 #includei n t Sq u a r e (int i)int m a in()“nt i =0;J=S q uare(i):for( ;iV3;i+)*stat i c i ni i =1;i +=S q

26、uare( i );printf(H%d/i);町printf L%dir;i);才 e tur n 0;7、2 #in c ludei nt ho u rjnin u te?s e c o nd;void up d ate()o s eco n d 十+;i f (se c ond=60)B s e cond=0:minute+;町“ f (min u t e = 6 0)。min u t e =0;ohour+ + ;if (hour= 2 4) h o u r=0;void di s pla y ()prin tf(”d, %d.%d n”.hou r jninu t e, second

27、):void d e 1 ay()i n t t ;f o r(t= 0 :t10 0 0 00000 ;t+):i n t main()v oi d u p daye (), d i s p I a y ( ).dclay(); for ( i =0; iint Get Max ( i nt aunt b);int m a i n()4nt x,y,ma x;opr i ntf(N I nputx,y:,r);os c an f ( H %d,%d &x,&y);?max=G e t Max(x,y);printf(H max=%dn,m a x):return 0 ;int GetM a

28、x ( i nt m, in t n)4f(m=n)g r eturn m;e Is e。 ret urn n;7、4 #in c lude h in t LCM( i nt n int m);int m a in()4 n t a, b ; oprintf(MI叩u t a, b : H); oscanf (H%d,%d &a.&b);prin t f(M%dnM, LCM( a ,b):才 e t ur n 0 ;in t LCM(int n , int ni)4n t x;i n t find= 0 ;f or( x = 1 ;! fin d : x+)血 f (x% n = 0 &x%

29、m=0)oo Jreturn x-1;7、5# i n c lu d eIo n g Fact(int n ):i n t mai n ()in t m, a ;printf (Tn p utm:);scanf( %dMt &m);ofor(a= 1 ; a =m;a+)prin t f(M %d!=%l d n,a,F a ct(a);?rc t urn 0;Ion g Fac t (i n t n)“nt i;lo n g r e s u lt=l;o f o r (i=2 ;i=n;i+)a resu I t*=i;才 e t u m r e suit:7、6 #in c 1 ud el

30、o n g Fac t ( i n t n):i nt ma i n()4nt m;Jo n g r et;op r intf (”I叩utm: ”);osc a nf(M%d 11,&m);re t =F a c t (m);prin tf(Hr e t=%dnf r et);o r e turn 0:long Fa c t (in tn)o oo ofind= 1 :in t i ;1 o ng re s u I t=Lsu m=0;for(i=2; ii nt Gc d ( i nt a J n t b);int main()i n t m. n ;nprin t f (HInputm,

31、 n: n):s c anf(H %d& n );p rintf(M%d nG c d(m n):a r eturn 0:i n t Gc d (int a int b )in t tjnin, fi n d=0; min=ab?a: b; t=min;f or(t=min;!find;t-)。a %t=0:4)%t=0;sif( a % t = 0 & & b %t=0)a re t u r n t:find= 1 ;7、7( 2 )# includeint G c d( i n t a , i n t b);i n t main()in t niJK p ri n tf(nI n putr

32、n, n :”);scanf (恢d,%d”,&m,&n);printf (” d n ”,Gcd(m,n); return 0;int Gcd( in t a, int b)int r temp;r= a %b;(r=0 )retu r n b;ncls e兄0t e mp=b;q b =r;a=temp;r=a%b;g while (r!=0):we t u rn b;8、1(1) #incl u dev o id Fu n c (int x )吠=2;)int m a in ()int x=10;nFunc( x );pr i ntf(H%dH, x):a r eturn 0;8、1 (

33、2) #incl ud e Vstdio、h void Func(int b )4nt j :nf o r (j= 0 ; j 4 ;j+)abj=j;Ji nt m a i n()ost a tic i n t a =5,6, 7, 8,i;u nc ( a );4or( i =0; i count=0;f or( i = 0 ; i0)。 cou n t+;arc t u r n 0;8、2(2) void Fib (long fi I on g n)inti; f 0=0;ofl=l;f or(i=2;in;i+)fi=f i T +22;)8 2 (3) #inc 1 u dei nt

34、 mai n ()in t a 1 0 ,n,max.min.m a xPosjn i nPos:4or( n =0;nvl 0 ;n卄)scanf(”d”,&an);max=mi n =a0;nmaxP o s=minPos= 0 :do r (n=0;nm a x)omax=an;g maxPos=n;)else if(anmin)oo 。 mi n = a n;ominPos= n;。pr i nt f (Mmax=%d,po sN,ma x ,m a x Po s );pri nlf (Hm i n=%d, pos=%d nM.mi n jni n P o s); return 0:8

35、、3 vo i d DivArray(in t * p A rra n)4nt i;fo r ( i =0;in: i+)oopArrayfi / =pAt t a y OJ;8、4 #i n clude#d e f i n e N 4 0i nt Fa i INuni (int s c o r e , i nt n );v oid ReadScore( i nt sc o re C,i n t n):in t main()in t score N , n ;op r i ntf(HInput n:u);sea n f(M%d &n);Re a d S co r e ( s cor

36、 e , n );Fai 1 Num(s c ore, n );pri n tf (Fa i lNum s t uden t s are %d n F a ilNum(sco r eji);return 0;int F ailNum (in t s coreJnt n)nt i,c o u nt=O;fo r (i=0; ivn;i+) i f ( s cor ei60)zcou n t+;or e t ur n cou n t;v oid RcadSc o re(int sc o re,int n )inti;printf (I叩utscorc:)for (i=0: ivn ;i+)s ca

37、n& s co r e i);8、5#i n clu d e# d e f i ne N 40i n t HighAver(in t sco r eJnt n );int Re a dSco r e(int sco r e):in t ma i n()int scor e N ,n;m=Rcad Sco re(scor e );pr i ntf (Hi g h A v e r s t udents a re %dn,High Aver(scor e ,n): o r etu r n 0:i nt HighAver(int scoreJnt n )int i ,cou n t= 0 ,sum=0

38、.ave r ;(i=0: i n : i+)4 a sum=sum4- s corei;a av e r=s u m / n;fo r (i=0; i a v er)*co u nt+4-:arc t ur n coun t ;int ReadScore(int score)i nt i=-l;。d oi+;a pri n t f (HIn put scor e :oscanf(”d H,&sc ore i );Jw h ile(score i= 0 );r etu r n i;8、6 #inc 1 ud e # d ef i ne N 4 0i n t R e adScor e (int

39、s c oreJ long num ):int F i ndMax(int score JJong n u m , i nt n);i n t main()i n t score N, nun ax, n u m,t;long numN;4=Fin d Max(score.n);m a x=s c ore tj;n u m=numt;a p rint f (max =%d,num= %dn,max.num):ret u r n 0;)int ReadS c ore(int s c o re , 1 o ng num)4 n I i=-l:兄o H + + ;printf(HInput s tu

40、den 19s I D an d score: ”); sc a n f(H%l d % d&numi, &sc ore i);)whil e (numi0&score i =0);r eturn i ;int FindMax (in t sc o re| Ion g n umjnt n)4 n t ma x ,i;ma x =sco r e0;for( i = 1 ;im a x)m a x=sco r e i;retu r n i :8、7# incl ude# d ef i n e N 4 0in t Read (in t a);int Chan g eA r r y( i n t a,

41、i n t n):in t m a in()nt aNr intf(M %dir C h a n ge A rry( a .n):retu r n 0;in t Rea d(in t a)B i nt i;4or (i=0;ima x)ooma x =score i :maxpos=n;Qsc (a i 10# i n c 1 ude#def i n e N 5void ma i n()o i nt aNN:。i n t s um = 0;int i ,j;pr i n t f (請(qǐng)輸入一個(gè)%d*%d 得矩陣n JN.N);(i =0 : i N; i卄)gforQ =0 : j N; j+)

42、a scanf(M%d &aij );oo Jf o r( i = 0; i N i +)4 for(j =0; j N; j+)。if (i = jl I i + j =N- 1 )gsum=sum+aij;。町prin t f(”對(duì)角線元素之與為:%dn s um);8、II #include #dcfi n e N 2#dc f ine M 3voi d ma i n()intaNMLb NM;intij.sum 1 =0,sum2=0, sum=0;oprintf (H請(qǐng)輸入一個(gè)d *%d 得矩陣n ”,N, M);for( i = 0; iN; i卄)。f or(j =0; j M:

43、 j+)。-scanf(M% d &a i j):osuml= s uni 1+a i j;oooo 。p r i n tf(H 請(qǐng)輸入一個(gè) d*%d 得矩陣n ,N,M);ofor (i= 0 ;i vN;i+)ofor (j =0; j M: j卄)gscan f C%(F,&b i j);。 osum2=sum 2 +aij;oooo J Jsum=suml+sum2;叩曲 t f(”sum=%d n N, sum);8、12#includ e # def i ne N 7void Yan g H u i ( i nt aN N,i n t n );vo i d main()int ij

44、,n,bNN;opri n t f (MI n put n : H ;oscanfC%d &n);Yang Hui(b.n);4or (i=0: i n; i +)f or(j=0; j v= i ; j + + ) o sprint f(H%4d,b i j );aop r i nt f (Hn n);v oid YangHui (int aN N, i n t n )in t i, j;4o r (i=O;in; i+)0 i 0 =1;。a i i = 1 ;。f or( i =2; i n;i+ )for(j=l;j#d e fin e N 12void main()4nt i:in

45、t fN =1J;oprintf (H%d:%dnM,O, f|0);o p rintf(M%d: %dn ”丄fl);ofor(i=2;i#in clu d e # i ncludcv t i me、h#de f ine N 6 00 0vo i d m a in()i ntaN,i;int b 1 =0, b 2=0, b 3 = 0 , b4= 0 ,b5= 0 , b 6 = 0 ;4 1 oat pl, p2,p3, p4,p5,p6: osrand(time (NULL);of o r(i= 0 ;i 0);p 4=(flo a t)( b 4/6000 x 0);p5=(f 1

46、oat) ( b 5/6000、0);叩6=( f loa t )(b6/ 6 0 0 0 . 0);printf( ” 骰子出現(xiàn) 1 得概率:. 2fnM, p 1);prin t f(骰子出現(xiàn) 2 得槪率:、2fn,p2);pr i n叱骰子出現(xiàn)3得概率:、2A n p 3);p rin t f(骰子出現(xiàn)4得概率:、2fn,p4):pr i ntf (n骰子出現(xiàn)5得槪率:、2fn p5);opr i ntf(n 骰子出現(xiàn) 6 得概率2fnH,p6);9、1( 1 ) vo i d S * x Jnt *y)。i nt *pTemp; / /*pTemp未進(jìn)行初始化,*pTemp指向哪里位宜

47、 o*pTem p = *x;x =* y ;y =*pT e m p :)9、1(2) void S *x,int *y)4nt *pTemp;pTcmp=x;x=y;y = p Temp:/錯(cuò)誤,x,y沒(méi)有指向類型9、2# i nc 1 udcvsldio. hint m a i n()dm a 二123,4,5;int *p=a;p r i nt f (”d,%d, % d ,%d,%d,%d,%dn H ,*p,*(+p), (* p )+,P ),* P );return 0;)9、3#includ cVstd io、hvoid S * x,in t* y);int m a in()

48、oint 8 6 =12,345,6 ,b6 =1 1 , 2 2,33,44,5 5,66; i nt i;p r in t f(Befor e A rray nM):ofor(i= 0 ;iV6;i+)gpr i nt f (%dn,ai);4or(i=0; i 6; i +)。 pr i n t f(”dn”.bi);J4br( i = 0 ;i6;i+)(0 i , &b i );printfCAfter A r r ay n);f or( i = 0;i6;i+)。pr i ntf (“ dn”,ai);ofor(i=0; i a temp=*x;oa*X=*y;a * y = t

49、emp9、4 #i nc 1 ude# def i ne N 10void FindMaxM i n (in t aJnt *pM a xa, i n t *pMaxnum,in t *pMin a ,int * p Mi n num);int ma i n()i n t aN;int i.m a x a jnina,m a xnum.mi n n um;p r i nt f (Fput a:H);for (i=0; i 10; i +)scanfC% d&a i);FindMaxM i n (a,&ma x a,& maxnum.&mina, & minnum);opr i ntf( * i

50、n a x a=%da x n um=%d,nii n a=%d,mi n num=%dnnjnaxa, maxnum, m i n a jnin n u m): a r eturn 0;v oid Fi n dMaxMi n (int a , int *pMax a Jn t *p Maxnum J n t *pMinaj n t *pMinnum)i n t i;*pMa x a =a 0:*pMina= a 0;pMa x num=0:o*pM i n num=0;of or (i=0: i *pMa x a)。a* pMax a =ai;a *pMa x num=i;)a el s e

51、 if( a i *pM i na)g *pMi n a= a i;ooo*pMin n u m= i :10、1 void MYStrcpy (char *dstS(r, const char *s r c Str)nwh i 1 e (*ds t Str+=* s r c Str+)1 =A0 *)4 10.2 #in c lud e h ma i n()char *a=uma i n()char *a=% c % s%c: pri n tf( a ,34a 3 4);H;prin t f ( a ,34,a,34); 10 3 (1) unsign ed int MySt r len(c

52、 h ar * p )m a i n()Hins i g n ed int I e n ;4en= 0 :4or (: * p a! =、O;pa +)al e n+;retu r n le n ;10、3 (2) unsi g ned i nt MyStrlen(c h a r sJ)char *p=s:whil e (*p!=、0)op+;return (p-*p);10、3 (3) i nt MyStrcm p ( c har *p 1 .char *p 2 )of o r (;*pl=* p 2 ;p 1 +.p 2 +)Mf(*pl=0,) r etu r n 1;return 1

53、;10 3(4 ) int My S trcmp(char s, char t)4nt i;4or(i=0; s i = t i ; i+)if(s i =(X) r e tu r n 0:e t u rn i :10、3 (5) #includ cVstdio、h #i n cludeint m a in()char p assword7 =Hse c retM ; charuserlnpu t81;npri n t f (MInpu t Password: H):s c a n f (M%s M userinput);if(str c mp (user I nput.passw o rd)=0)aprin t f(MC o orr e ct pa s swo r d!Wele to th e s yslcm、n u):吃Isc i f(strcmp( u ser I np u

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論