1、校园网·新视野教育二级C上机考试复习资料 V16.0
(共50套题目)
第1套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include
2、 t *= (-1.0)*x/___2___;
f += t;
}
/**********found**********/
while (___3___ >= 1e-6);
return f;
}
main()
{ double x, y;
x=2.5;
y = fun(x);
printf("\nThe result is :\n");
printf("x=%-12.6f y=%-12.6f\n", x, y);
}
2、程序修改题
#include
3、int x,int y,long *p )
{ int i;
long t=1;
/**************found**************/
for(i=1; i 4、
t=fun(x,y,&r);
printf("\n\nx=%d, y=%d, r=%ld, last=%ld\n\n",x, y,r,t );
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 5、
第2套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include 6、 c2++;___3___;
case 3: c3++;
}
n /= 10;
}
}
main()
{ long n=L;
fun(n);
printf("\nThe result :\n");
printf("n=%ld c1=%d c2=%d c3=%d\n",n,c1,c2,c3);
}
2、程序修改题 校园网·新视野教育上机考试复习资料
#include 7、ount=0,max=0,t;
do
{ t=n%10;
/**************found**************/
if(t=0)
count++;
if(max 8、nsigned): "); scanf("%d",&n);
max = fun( n,&zero );
printf("\nThe result: max=%d zero=%d\n",max,zero);
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 9、f("\n\ns=%f\n\n",s);
}
第3套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include 10、/
n=__3__;
}
return x;
}
main()
{ unsigned long n=-1;
while(n>99999999||n<0)
{ printf("Please input(0 11、d;
long sl=1;
/************found************/
t = 0;
while ( s > 0)
{ d = s%10;
/************found************/
if (d%2 == 0)
{ *t = d * sl + *t;
sl *= 10;
}
s /= 10;
}
}
main()
{ long s, t;
printf("\nPlease enter s:"); scanf("%ld", &s);
fun( 12、s, &t);
printf("The result is: %ld\n", t);
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 13、f("Invoke fun(s1,s2):\n") ;
fun(s1, s2) ;
printf("After invoking:\n") ;
printf("%s\n", s1) ;
}
第4套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include 14、 rmax=a[i][0]; c=0;
for(j=1; j 15、 printf("find: a[%d][%d]=%d\n",i,c,a[i][c]);
/**********found**********/
__3__ ;
}
if(!find) printf("not found!\n");
}
main()
{ int x[M][N],i,j;
printf("Enter number for array:\n");
for(i=0; i 16、 for(i=0; i 17、found**************/
y -= 1 /(i * i) ;
return( y ) ;
}
main( )
{ int n = 5 ;
printf( "\nThe result is %lf\n", fun ( n ) ) ;
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 18、nt score[9] = {10, 20, 30, 40, 50, 60, 70, 80, 90} ;
n = fun(score, 9, below) ;
printf( "\nBelow the average score are: " ) ;
for (i = 0 ; i < n ; i++) printf("%d ", below[i]) ;
}
第5套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include 19、
#define M 10
/**********found**********/
void fun(char (*ss) __1__, int k)
{ int i=0 ;
/**********found**********/
while(i< __2__) {
/**********found**********/
ss[i][k]=__3__; i++; }
}
main()
{ char x[N][M]={"Create","Modify","Sort","skip","Delete"};
int i;
printf 20、"\nThe original string\n\n");
for(i=0;i 21、t; int n=1;
s=0.0;
/************found************/
t=0;
while( t>eps)
{ s+=t;
t=t * n/(2*n+1);
n++;
}
/************found************/
return(s);
}
main()
{ double x;
printf("\nPlease enter a precision: "); scanf("%lf",&x);
printf("\neps=%lf, 22、 Pi=%lf\n\n",x,fun(x));
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 23、r a string:\n");gets(s);
printf("Enter n : ");scanf("%d",&n);
fun( s,n );
printf("The string after deleted:\n");puts(s);
}
第6套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include 24、r(i=1; i 25、\n");
for(i=0; i 26、 27、ut x y z: ");
scanf("%f%f%f",&x,&y,&z);
printf("x=%f,y=%f,z=%f\n",x,y,z);
if (x==y||y==z){printf("Data error!\n");exit(0);}
sum=fun(x,y,z);
printf("The result is : %5.2f\n",sum);
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 28、
{ char s[81];
printf("Enter a string:\n");gets(s);
fun( s );
printf("The string after deleted:\n");puts(s);
}
第7套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include 29、
/**********found**********/
for(i = 0 ; i < __2__ ; i++)
{ temp=a[0][i] ;
/**********found**********/
a[0][i] = __3__ ;
a[k][i] = temp ;
}
}
main()
{ int x[M][N]={ {1,2,3},{4,5,6},{7,8,9},{10,11,12} },i,j;
printf("The array before moving:\n\n");
for(i=0; i 30、{ for(j=0; j 31、
void fun( char t[] )
{
char c;
int i, j;
/**********found***********/
for( i = strlen( t ); i; i-- )
for( j = 0; j < i; j++ )
/**********found***********/
if( t[j] < t[ j + 1 ] )
{
c = t[j];
t[j] = t[ j + 1 ];
t[j + 1 ] = c;
}
}
32、main()
{
char s[81];
printf( "\nPlease enter a character string: " );
gets( s );
printf( "\n\nBefore sorting:\n \"%s\"", s );
fun( s );
printf( "\nAfter sorting decendingly:\n \"%s\"\n", s );
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 33、char *ss )
{
}
void main( void )
{
printf( "\nPlease enter an character string within 50 characters:\n" );
gets( tt );
printf( "\n\nAfter changing, the string\n \"%s\"", tt );
fun(tt) ;
printf( "\nbecomes\n \"%s\"", tt );
}
第8套 校园网·新视野教育上机考试复习资料
1、程序填空题 34、
#include 35、 }
t++;
}
return n;
}
main()
{ int x=-1;
while(x<0)
{ printf("Please input(x>0): "); scanf("%d",&x); }
printf("\nThe result is: %d\n",fun(x));
}
2、程序修改题 校园网·新视野教育上机考试复习资料
#include 36、sl=10;
s /= 10;
*t = s % 10;
/************found************/
while ( s < 0)
{ s = s/100;
*t = s%10*sl + *t;
sl = sl * 10;
}
}
main()
{ long s, t;
printf("\nPlease enter s:"); scanf("%ld", &s);
fun(s, &t);
printf("The result is: %ld\n", t 37、);
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 38、{ STREC s[N]={{"GA005",85},{"GA003",76},{"GA002",69},{"GA004",85},
{"GA001",91},{"GA007",72},{"GA008",64},{"GA006",87},
{"GA015",85},{"GA013",91},{"GA012",64},{"GA014",91},
{"GA011",66},{"GA017",64},{"GA018",64},{"GA016",72}};
int i;FILE *out ;
fun( s );
printf("The data afte 39、r sorted :\n");
for(i=0;i 40、out,"\n");
fclose(out) ;
}
第9套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include 41、found**********/
sum+= t[i][n-i-___3___] ;
return sum;
}
main()
{ int t[][N]={21,2,13,24,25,16,47,38,29,11,32,54,42,21,3,10},i,j;
printf("\nThe original data:\n");
for(i=0; i 42、"The result is: %d",fun(t,N));
}
2、程序修改题 校园网·新视野教育上机考试复习资料
#include 43、
while(fabs(n-m)<0.001)
{ if(funx(r)*funx(n)<0) m=r;
else n=r;
r=(m+n)/2;
}
return r;
}
main( )
{ double m,n, root;
printf("Enter m n : \n"); scanf("%lf%lf",&m,&n);
root=fun( m,n );
printf("root = %6.3f\n",root);
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#i 44、nclude 45、
第10套 校园网·新视野教育上机考试复习资料
1、程序填空题
#include 46、The result :\n");
c1='2'; c2 = fun(c1);
printf("c1=%c c2=%c\n", c1, c2);
c1='8'; c2 = fun(c1);
printf("c1=%c c2=%c\n", c1, c2);
c1='a'; c2 = fun(c1);
printf("c1=%c c2=%c\n", c1, c2);
}
2、程序修改题 校园网·新视野教育上机考试复习资料
#include 47、har *b)
{ int i, k=0;
while(*p)
{ i=1;
while( i<=3 && *p ) {
/**********found**********/
b[k]=p;
k++; p++; i++;
}
if(*p)
{
/**********found**********/
b[k++]=" ";
}
}
b[k]='\0';
}
main()
{ char a[80],b[8 48、0];
printf("Enter a string: "); gets(a);
printf("The original string: "); puts(a);
fun(a,b);
printf("\nThe string after insert space: "); puts(b); printf("\n\n");
}
3、程序设计题 校园网·新视野教育上机考试复习资料
#include 49、 double s;
struct slist *next;
};
typedef struct slist STREC;
double fun( STREC *h )
{
}
STREC * creat( double *s)
{ STREC *h,*p,*q; int i=0;
h=p=(STREC*)malloc(sizeof(STREC));p->s=0;
while(i 50、p=q;
}
p->next=0;
return h;
}
outlist( STREC *h)
{ STREC *p;
p=h->next; printf("head");
do
{ printf("->%4.1f",p->s);p=p->next;}
while(p!=0);
printf("\n\n");
}
main()
{ double s[N]={85,76,69,85,91,72,64,87},ave;
STREC *h;
h=creat( s ); outlist(h);
ave=






