例如,输入一个数:27638496,新的数:为739。
请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。
注意:源程序存放在考生文件夹下的BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
#include
void fun(unsigned long *n)
{ unsigned long x=0, i; int t;
i=1;
while(*n)
/**********found**********/
{ t=*n % __1__;
/**********found**********/
if(t%2!= __2__)
{ x=x+t*i; i=i*10; }
*n =*n /10;
}
/**********found**********/
*n=__3__;
}
main()
{ unsigned long n=-1;
while(n>99999999||n<0)
{ printf("Please input(0
fun(&n);
printf("\nThe result is: %ld\n",n);
}
22、给定程序中,函数fun的功能是:利用指针数组对形参ss所指字符串数组中的字符串按由长到短的顺序排序,并输出排序结果。ss所指字符串数组中共有N个字符串,且串长小于M。
请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。
注意:源程序存放在考生文件夹下的BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
#include
#include
#define N 5
#define M 8
void fun(char (*ss)[M])
{ char *ps[N],*tp; int i,j,k;
for(i=0; i
for(i=0; i
/**********found**********/
k= __1__ ;
for(j=i+1; j
/**********found**********/
if(strlen(ps[k]) < strlen(__2__) ) k=j;
/**********found**********/
tp=ps[i]; ps[i]=ps[k]; ps[k]= __3__ ;
}
printf("\nThe string after sorting by length:\n\n");
for(i=0; i
}
main()
{ char ch[N][M]={"red","green","blue","yellow","black"};
int i;
printf("\nThe original string\n\n");
for(i=0;i
fun(ch);
}
| 广告合作:400-664-0084 全国热线:400-664-0084 Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号 珠峰网 版权所有 All Rights Reserved
|