泰道控制系统硬件开发工程师笔试题和面试题答案(三)
fpd2=fopen(“d2.dat”,“w”) ;
while(fscanf(fpd1,“%c”,&ch)!=EOF)
if (ch>='A'&& ch <='Z' ‖ ch>='a'&& ch<='z')
fprintf(fpd2,“%c”,ch);
fclose(fpd1);
fclose(fpd);
}
21:试将下列递归过程改写为非递归过程。
void test(int &sum)
{ int x;
scanf(x);
if(x=0) sum=0 else {test(sum); sum+=x;}
printf(sum);
}
22:对给定记录的序号k(1
23:Write a program to remove all trailing blanks and tabs from each line of input, and to delete entirely blank lines.
24:int func(int a)
{
int b;
switch(a)
{
case 1: 30;
case 2: 20;
case 3: 16;
default: 0
}
return b;
}
则func(1)=?
25:Write a function reverse(s) that reverses the character string s . Use it to write a program that reverses its input a line at a time.