c程式设计—阵列内容摘要:

39。 )。 22 } /* e nd in ne r fo r * / 23 Use the value of an array element in the loop condition Copyright 19922020 by Deitel amp。 Associates, Inc. and Pearson Edition Inc. All right Reserved. Element Value Histogram 0 19 ******************* 1 3 *** 2 15 *************** 3 7 ******* 4 11 *********** 5 9 ********* 6 13 ************* 7 5 ***** 8 17 ***************** 9 1 * 24 p r i n t f ( \ n )。 / * s t a r t n e x t l i n e o f o u t p u t * / 25 } / * e n d o u t e r f o r * / 26 27 r e t u r n 0。 / * i n d i c a t e s s u c c e s s f u l t e r m i n a t i o n * / 28 29 } / * e n d m a i n * / Copyright 19922020 by Deitel amp。 Associates, Inc. and Pearson Edition Inc. All right Reserved. 1 / * F i g . 6 . 7 : f i g 0 6 _ 0 7 . c 2 S t u d e n t p o l l p r o g r a m * / 3 i n c l u d e s t d i o . h 4 d e f i n e R E S P O N S E _ S I Z E 40 / * d e f i n e a r r a y s i z e s * / 5 d e f i n e F R E Q U E N C Y _ S I Z E 11 6 7 / * f u n c t i o n m a i n b e g i n s p r o g r a m e x e c u t i o n * / 8 i n t m a i n ( ) 9 { 10 int a n s w e r。 / * c o u n t e r * / 11 int r a t i n g。 / * c o u n t e r * / 12 13 / * i n i t i a l i z e f r e q u e n c y c o u n t e r s t o 0 * / 14 int f r e q u e n c y [ F R E Q U E N C Y _ S I Z E ] = { 0 }。 15 16 / * p l a c e s u r v e y r e s p o n s e s i n a r r a y r e s p o n s e s * / 17 int r e s p o n s e s [ R E S P O N S E _ S I Z E ] = { 1 , 2 , 6 , 4 , 8 , 5 , 9 , 7 , 8 , 10 , 18 1 , 6 , 3 , 8 , 6 , 10 , 3 , 8 , 2 , 7 , 6 , 5 , 7 , 6 , 8 , 6 , 7 , 5 , 6 , 6 , 19 5 , 6 , 7 , 5 , 6 , 4 , 8 , 6 , 8 , 10 }。 20 Copyright 19922020 by Deitel amp。 Associates, Inc. and Pearson Edition Inc. All right Reserved. Rating Frequency 1 2 2 2 3 2 4 2 5 5 6 11 7 5 8 7 9 1 10 3 21 / * f o r e a c h a n s w e r , s e l e c t v a l u e o f a n e l e m e n t o f a r r a y r e s p o n s e s 22 a n d u s e t h a t v a l u e a s s u b s c r i p t i n a r r a y f r e q u e n c y t o 23 d e t e r m i n e e l e m e n t t o i n c r e m e n t * / 24 for ( a n s w e r = 0。 a n s w e r R E S。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。