函数fun的功能是:将a、b中的两个两位正整数合并形成一个新的整数放在c中,合并的方式是:将a中的十位和个位数依次放在变量c的千位和十位上,b中的十位数和个位数依次放在变量c的个位和百位上。
例如:a=45,b=12。调用该函数后:c=4251。
注意:
请勿改动主函数main和其他函数中的任何内容,仅在fun函数的花括号中填入所编写的若干语句。
/**********code.c**********/
#include
void fun(int a, int b, long *c)
{
}
void main()
{
void NONO ();
int a,b;long c;
printf("Input a,b:");
scanf("%d %d",&a,&b);
fun(a,b,&c);
printf("The result is:%ld\n",c);
NONO ();
}
void NONO ()
{/*本函数用于执行测试,勿动*/
FILE *rf, *wf ;
int i, a,b ; long c ;
rf = fopen("in.dat","r") ;
wf = fopen("out.dat","w") ;
for(i = 0 ; i < 10 ; i++) {
fscanf(rf, "%d,%d", &a, &b) ;
fun(a, b, &c) ;
fprintf(wf, "%ld\n", c) ;
}
fclose(rf) ;
fclose(wf) ;
}
/**********-code.c**********/
/**********indat**********/
45,12
63,54
14,78
88,91
71,13
12,45
72,32
29,99
34,43
22,44
/**********-indat**********/
/**********outdat**********/
4251
6435
1847
8189
7311
1524
7223
2999
3344
2424
/**********-outdat**********/