| 
 | 
 需要购买此门答案请加qq2762169544(微信:2762169544) 
 
读程序,写出程序执行结果 
#include <stdio.h> 
    void main() 
    {   int  i,n[]={1,2,3,4,5}; 
for(i=0;i<2;i++) 
{   n[i]=n[4-i]+1; 
            printf("%d ",n[i]); 
} 
for(i=0;i<5;i++) 
            printf("%d ",n[i]); 
    } 
 
 
      满分:5  分 
2.  读程序,写出程序执行结果 
#include <stdio.h> 
void f(int x, int y) 
      { int t; 
        if (x<y) { t=x; x=y; y=t; } 
      } 
      void main() 
     { int a=4,b=3,c=5; 
       f(a,b); f(a,c); f(b,c); 
       printf("%d,%d,%d\n",a,b,c); 
     } 
 
 
      满分:5  分 
3.  读程序,写出程序执行结果 
#include <stdio.h> 
void copy_str(char  from[ ],char to[ ]) 
{  int  k=0; 
while(from[k]!=‘\0’) 
{ to[k]=from[k]; k++;    } 
      to[k]=‘\0’;      /*末尾加上串结束标志*/ 
} 
void main() 
{  char  str1[80]=”red”,str2[80]=”green”; 
     copy_str (str1,str2); 
     puts(str2); 
} 
 
 
      满分:5  分 
4.  读程序,写出程序执行结果 
#include <stdio.h> 
    #include <string.h> 
int stre(char *s) 
{  int num=0; 
   while(*(s+num)!=‘\0’)num++; 
   return num; 
} 
void main() 
{  char str[]="students",*p=str; 
   printf(“%d\n”,stre(p)); 
} 
 
 
      满分:5  分 
5.   
读程序,写出程序执行结果 
   #include <stdio.h> 
void main() 
{ int i=0,a=0; 
while( i<20 ) 
{  for(;;) 
if((i%10)==0) break; 
else i--; 
         i+=11; 
         a+=i; 
} 
printf("%d\n",a); 
} 
 
 
      满分:5  分 
6.   
读程序,写出程序执行结果 
#include <stdio.h> 
void ex( ) 
{  static int x=5 ;   
--x ;   
printf(“%d”,x) ; 
}  
void  main ( ) 
{  ex( );   
ex( );   
ex( ); 
  } 
 
 
      满分:5  分 
7.   
读程序,写出程序执行结果 
   #include <stdio.h> 
   #define MAX(a,b)  (a>b ? a : b)+1 
   void main() 
   { int i=6,j=8; 
     printf(“%d\n”,MAX(i,j)); 
 } 
 
 
      满分:5  分 
8.   
读程序,写出程序执行结果 
     #include <stdio.h> 
int fun(char *s1,char *s2) 
     { int i=0; 
      while(s1[i]==s2[i] && s2[i]!='\0') i++; 
return (s1[i]=='\0' && s2[i]=='\0'); 
} 
void main() 
{ char p[10]= "abcdef", q[10]= "ABCDEF" 
  printf("%d\n",fun(p,q)); 
} 
 
 
      满分:5  分 
9.   
读程序,写出程序执行结果 
   #include <stdio.h> 
int fun(int x) 
{ int y=1; 
static int z=4; 
z+=1; ++y; 
return(x+y+z); 
} 
void main() 
{ int i; 
for(i=1;i<=3;i++) 
printf("%3d",fun(i)); |   
 
 
 |