更多"以下程序打开新文件f.txt,并调用字符输出函数将a数组中的字符写入其"的相关试题:
[填空题]以下程序打开新文件f.txt,并调用字符输出函数将a数组中的字符写入其中,请填空。
#include <stdio.h>
main( )
______*fp;
char a[5]=’1’,’2’,’3’,’4’,’5’),i;
fp=fopen("f.txt", "w");
for(i=0; 1<5; i++) fputc(a[i],fp);
fclose(fp);
[填空题]以下程序中,函数fun的功能是计算x2-2x+6,主函数中将调用fun函数计算,请填空。
y1=(x+8)2-2(x+8)+6
y2=sin2(x)-2sin(x)+6
#include "math.h"
double fun(double x) return( (8) );
main( )
( double x,y1,y2;
printf("Enter x:"); scanf("%1f",&x);
yl=fun(8+x);
y2=fun( (9) );
printf("y1 =%1f,y2=%1f/n",y1,y2);
[填空题]以下程序段打开文件后,先利用fseek函数将文件位置指针定位在文件末尾,然后调用 ftell函数返回当前文件位置指针的具体位置,从而确定文件长度。请填空。
FILE * myf;long f1;
myf= 【20】 ("test.t","rb");
fseek(myf,0,SEEK END) ;
f1=ftell(myf);
fclose(myf);
printf("%d/n",f1);
[填空题]以下程序段打开文件后,先利用fseek函数将文件位置指针定位在文件末尾,然后调用ftell函数返回当前文件位置指针的具体位置,从而确定文件长度。请填空。
FILE *myf; long f1;
myf=______("test,t","rb");
fseek(myf,0,SEEK_END) ;f1=ftell(myf);
fclose(myf);
printf("%1d/n",f1);
[填空题]以下程序段打开文件后,先利用fseek函数将文件位置指针定位在文件末尾,然后调用删函数返回当前文件位置指针的具体位置,从而确定文件长度,请填空。
FILE*myf;long fl;
myf= 【15】 ("test.t","rb");
fseek(myf,( ),SEEK_END);fl+ftell(myf);
fclose(myf);
printf("%d/n",fl);
[填空题]以下程序中,函数fun的功能是计算X的2次方-2x+6,主函数中将调用fun函数计算:
y1=(x+8)的2次方-2(X+8)+6
y2=sin2(x)一2sin(x)+6
请填空。
#include "math.h"
double fun(double X){return(X*x-2*X+6);}
main( )
{double x,yl,y2;
printf("Enter x:");scanf("%If",&x);
y1=fun(【 】);
y2=fun(【 】);
printf("y1=%If,y2=%lf\n",y1,y2);
}
[填空题]以下程序调用函数swap将指针s和t所指单元(a和b)中的内容交换,请填空。
main( )
int a=10,b=20,*s,*t;
s=&a;t=&b;
______
printf("%d%d",a,b);
swap(int*ss,int*tt)
int te;
te=*ss;
*ss=*tt;
*tt=te;
[填空题]以下程序调用函数swap_p将指针s和t所指单元(a和b)中的内容交换,请填空。
main( )
int a=10,b=20,*s,*t;
s=&a;t=&b;
swap_p( 【13】 );
printf("%d%d,a,b");
swap_p(int**ss,int**tt)
int term;
term=**ss;
**ss=**tt;
**tt=term;
[填空题]设函数findbig已定义为求3个数中的最大值。以下程序将利用函数指针调用findbig函数。请填空。
main( )
int findbig(int,int,int);
int (*f) ( ) ,x,y, z,big;
f=______;
scanf("%d%d%d",&x,&y,&z:
big=(*f)(x,y,Z);
printf("big=%d/n",big);