a[i++]=b[j]; a[i]='\\0'; puts(a); }
6.3.8 ´Ó¼üÅÌÊäÈë10¸öÊý¸øÊý×éa£¬È»ºóÄæÐòÊä³ö¡£
²Î¿¼´ð°¸
#include
int i,a[10];
for(i=0;i<=9;i++)
scanf(\ for(i=9;i>=0; i--)
printf(\}
6.3.9 ÊäÈë10¸ö0µ½100µÄËæ»úÕûÊýµ½Ö¸¶¨µÄÊý×éÖС£
²Î¿¼´ð°¸
#include
int i,a[10]={0};
srand(50); /*³õʼ»¯Ëæ»úÊýÐòÁÐ*/ for(i=0;i<10;i++) {
a[i]=rand()0; /*²úÉú100ÒÔÄÚµÄËæ»úÕûÊý*/ }
for(i=0;i<10;i++)
printf(\}
6.3.10 Ϊ±ÈÈüÑ¡ÊÖÆÀ·Ö¡£ ¼ÆËã·½·¨£º´Ó1 0ÃûÆÀίµÄÆÀ·ÖÖп۳ýÒ»¸ö×î¸ß·Ö£¬¿Û³ýÒ»¸ö×îµÍ·Ö£¬È»ºóͳ¼Æ×Ü·Ö£¬²¢³ýÒÔ8£¬×îºóµÃµ½Õâ¸öÑ¡ÊÖµÄ×îºóµÃ·Ö(´ò·Ö²ÉÓðٷÖÖÆ)¡£
²Î¿¼´ð°¸
#include
int score[10]; /* 10 ¸öÆÀίµÄ³É¼¨*/ float mark; /* ×îºóµÃ·Ö*/ int i;
int max =-1; /*×î¸ß·Ö*/ int min =101; /*×îµÍ·Ö*/
int sum=0; /*10¸öÆÀίµÄ×ܺÍ*/ for( i =0 ; i < 10 ; i ++)
{
printf(\ scanf(\ sum=sum+score[i]; }
for(i = 0 ; i < 10 ; i++) {
if(score[i] > max) max = score[i]; }
for(i = 0;i < 10 ; i++) {
if(score[i] mark = ( sum - min - max ) / 8.0; printf(\} Ï°ÌâÆß´ð°¸ Ï°ÌâÆß 7.1 Ñ¡ÔñÌâ 7.1.1 ÔÚÒ»¸öCÓïÑÔ³ÌÐò¹¹³ÉÖУ¬½ÏÍêÕûµÄÃèÊöÊÇ£¨D £© A) ÓÉÖ÷³ÌÐòÓë×Ó³ÌÐò¹¹³É B) Óɶà¸öÖ÷º¯ÊýÓë¶à¸ö×Óº¯Êý¹¹³É C) ÓÉÖ÷º¯ÊýÓë×Óº¯Êý¹¹³É D) ÓÉÒ»¸öÖ÷º¯ÊýÓë¶à¸ö×Óº¯Êý¹¹³É 7.1.2 CÓïÑÔÔÚ³ÌÐò¿ªÊ¼Ö´ÐÐʱ£¬ÆäÕýÈ·µÄÃèÊöÊÇ£¨B £© A) Óɱàд³ÌÐòÓï¾äµÄ˳Ðò¸ñʽִÐÐ B) ÔÚÖ÷º¯Êýmain()¿ªÊ¼´¦Ö´ÐÐ C) ÔÚµÚÒ»¸ö×Óº¯Êý´¦Ö´ÐÐ D) ÓÉÈËËæ»úÑ¡ÔñÖ´ÐÐ 7.1.3 ÏÂÁÐÓйغ¯Êý´íÎóµÄÃèÊöÊÇ£¨A £© A) CÓïÑÔÖÐÔÊÐíº¯ÊýǶÌ׶¨Òå B) CÓïÑÔÖÐÔÊÐíº¯ÊýµÝ¹éµ÷Óà C) µ÷Óú¯Êýʱ£¬Êµ²ÎÓëÐβεĸöÊý¡¢ÀàÐÍÐèÍêÈ«Ò»Ö D) CÓïÑÔº¯ÊýµÄȱʡÊý¾ÝÀàÐÍÊÇintÀàÐÍ 7.1.4 ÔÚCÓïÑÔÖУ¬¸÷¸öº¯ÊýÖ®¼ä¾ßÓеĹØϵÊÇ£¨D £© A) ²»ÔÊÐíÖ±½ÓµÝ¹éµ÷Óã¬Ò²²»ÔÊÐí¼ä½ÓµÝ¹éµ÷Óà B) ÔÊÐíÖ±½ÓµÝ¹éµ÷Ó㬲»ÔÊÐí¼ä½ÓµÝ¹éµ÷Óà C) ²»ÔÊÐíÖ±½ÓµÝ¹éµ÷Óã¬ÔÊÐí¼ä½ÓµÝ¹éµ÷Óà D) ÔÊÐíÖ±½ÓµÝ¹éµ÷Óã¬Ò²ÔÊÐí¼ä½ÓµÝ¹éµ÷Óà 7.1.5 ÔÚCÓïÑÔÖУ¬º¯ÊýµÄ·µ»ØÖµµÄÀàÐÍÊÇÓÉ£¨D £© A) CÓïÑԵıàÒë³ÌÐò£¬ÔÚ³ÌÐò±àÒëʱ¾ö¶¨ B) Óɵ÷Óøú¯ÊýµÄÖ÷µ÷º¯ÊýËù¾ö¶¨ C) ÓÉreturnÓï¾äµÄ±í´ïʽµÄÀàÐÍËù¾ö¶¨ D) Óɶ¨Òå¸Ãº¯Êýʱָ¶¨µÄº¯ÊýÀàÐÍËù¾ö¶¨ 7.1.6 µ±µ÷Óú¯Êýʱ£¬Èç¹ûʵ²ÎÊÇÒ»¸öÊý×éÃû£¬ÔòÏòº¯Êý´«Ë͵ÄÊÇ£¨B £© A) Êý×éµÄÊ×ÔªËØ B) Êý×éµÄÊ×µØÖ· C) Êý×éÿ¸öÔªËصĵØÖ· D) Êý×éÿ¸öÔªËØÖеÄÖµ 7.1.7 ¶ÔÓÚÒÔϳÌÐò£¬²»ÕýÈ·µÄÐðÊöÊÇ£¨A £© #include void f(int n); /*º¯Êý˵Ã÷*/ void main() { void f(int n); /*º¯Êý˵Ã÷*/ f(5); } void f(int n) { printf(\ } A) ÈôÖ»ÔÚÖ÷º¯ÊýÖжԺ¯Êýf½øÐÐ˵Ã÷£¬ÔòÖ»ÄÜÔÚÖ÷º¯ÊýÖÐÕýÈ·µ÷Óú¯Êýf B) ÒªÇóº¯ÊýfÎÞ·µ»ØÖµ£¬ËùÒÔ¿ÉÓÃvoid½«ÆäÀàÐͶ¨ÒåΪÎÞÖµÐÍ C) ÔÚÖ÷º¯ÊýÇ°¶Ôº¯Êýf½øÐÐ˵Ã÷£¬ÔòÔÚÖ÷º¯ÊýºÍÆäºóµÄÆäËüº¯ÊýÖж¼¿ÉÒÔÕýÈ·µ÷ Óú¯Êýf D) ¶ÔÓÚÉÏÃæ³ÌÐòµÄ˵Ã÷£¬±àÒëʱϵͳ»áÌáʾ³ö´íÐÅÏ¢£ºÌáʾ¶Ôfº¯ÊýÖظ´ËµÃ÷ 7.1.8 ÒÔϳÌÐòµÄÊä³ö½á¹ûÊÇ£¨A £©¡£ long fun( int n) { long s; if(n==1 || n==2) s=2; else s=n-fun(n-1); return s;} void main() { printf(\ A) 1 B) 2 C) 3 D) 4 7.1.9 ÓÐÒÔϳÌÐòÖ´ÐкóÊä³öµÄ½á¹ûÊÇ£¨C £©¡£ int f1(int x,int y) { return x>y?x:y; } int f2(int x,int y) { return x>y?y:x; } main() {int a=4,b=3,c=5,d,e,f; d=f1(a,b); d=f1(d,c); e=f2(a,b); e=f2(e,c); f=a+b+c-d-e; printf(\} A£©3,4,5 B£©5,3,4 C£©5,4,3 D£©3,5,4 7.1.10 ÉèÓÐÒÔϺ¯Êý; f(int a) { int b=0; static int c=3; b++;c++; return(a+b+c); } Èç¹ûÔÚÏÂÃæµÄ³ÌÐòÖе÷Óøú¯Êý£¬ÔòÊä³ö½á¹ûÊÇ£¨A £©¡£ void main() { int a=2, i; for(i=0;i<3;i++) printf(\ } a) b) c) d) 7 7 7 7 8 9 10 7 9 11 13 7 A£©a) B£©b) C£©c) D£©d) 7.1.11 ÒÔϳÌÐòµÄÊä³ö½á¹ûÊÇ£¨C £©¡£ int x=3; void main() { int i; for(i=1;i incre() { static int x=1; x*=x+1; printf(\} A£©3 3 B£©2 2 C£©2 6 D£©2 5 7.1.12 ÒÔϳÌÐòÖеĺ¯ÊýreverseµÄ¹¦ÄÜÊǽ«aËùÖ¸Êý×éÖеÄÄÚÈݽøÐÐÄæÖᣳÌÐòÔË ÐкóµÄÊä³ö½á¹ûÊÇ£¨A £©¡£ void reverse(int a[],int n) {int i,t; for(i=0;i {t=a[i];a[i]=a[n-1-i];a[n-1-i]=t;} } void main() {int b[10]={1,2,3,4,5,6,7,8,9,10}; int i,s=0; reverse(b,8); for(i=6;i<10;i++) s+=b[i]; printf(\} A£©22 B£©10 C£©34 D£©30 7.1.13 ³ÌÐòÔËÐкóµÄÊä³ö½á¹ûÊÇ£¨C £©¡£ #include