1 / 23
文档名称:

计算机二级考试上机真题100套11-20.doc

格式:doc   大小:71KB   页数:23页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

计算机二级考试上机真题100套11-20.doc

上传人:fy3986758 2018/11/28 文件大小:71 KB

下载得到文件列表

计算机二级考试上机真题100套11-20.doc

文档介绍

文档介绍:#include <>
typedef struct
{ int num;
char name[10];
}PERSON;
/**********found**********/
void fun(PERSON ___1___)
{
/**********found**********/
___2___ temp;
if(std[0].num>std[1].num)
{ temp=std[0]; std[0]=std[1]; std[1]=temp; }
if(std[0].num>std[2].num)
{ temp=std[0]; std[0]=std[2]; std[2]=temp; }
if(std[1].num>std[2].num)
{ temp=std[1]; std[1]=std[2]; std[2]=temp; }
}
main()
{ PERSON std[ ]={ 5,"Zhanghu",2,"WangLi",6,"LinMin" };
int i;
/**********found**********/
fun(___3___);
printf("\nThe result is :\n");
for(i=0; i<3; i++)
printf("%d,%s\n",std[i].num,std[i].name);
}
0000000000000000000
#include <>
#include <>
int fun ( char str[][10], int m, char *pt )
{
/************found************/
Int k, q, i ;
for ( k = 0; k < m; k++ )
{ q = strlen ( str [k] );
for (i=0; i<q; i++)
/************found************/
pt[i] = str[k,i] ;
pt += q ;
pt[0] = 0 ;
}
}
main( )
{ int m, h ;
char s[10][10], p[120] ;
printf( "\nPlease enter m:" ) ;
scanf("%d", &m) ; gets(s[0]) ;
printf( "\nPlease enter %d string:\n", m ) ;
for ( h = 0; h < m; h++ ) gets( s[h]) ;
fun(s, m, p) ;
printf( "\nThe result is : %s\n", p) ;
}
0000000
#include <>
#include <>
#define N 5
int fun ( int a[][N] )
{
}
NONO( )
{/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。*/
FILE *rf, *wf ;
int i, j, a[5][5] ;
rf = fopen("C:\\WEXAM\\YS240001\\","r") ;
wf = fopen("C:\\WEXAM\\YS240001\\","w") ;
for(i = 0 ; i < 5 ; i++)
for(j = 0 ; j < 5 ; j++)
fscanf(rf, "%d ", &a[i][j]) ;
fun(a) ;
for ( i = 0; i < 5; i++ ) {
for ( j = 0; j < 5; j++ ) fprintf(wf, "%4d", a[i][j] );
fprintf(wf, "\n");
}
fclose(rf) ;
fclose(wf) ;
}
main ( )
{ int a[N][N], i, j;
printf("***** The array *****\n");
for ( i =0; i<N; i++ )
{ for ( j =0; j<N; j++ )
{ a[i][j] = rand()%10; printf( "%4d", a[i][j] ); }
printf("\n");
}
fun ( a );
printf ("THE RESULT\n");
for ( i =0; i<N; i++ )