> 其他 >
1.根据以下函数关系,对输入的每个x值,计算出相应的y值,请填空使程序完整
main ( )
{
int x,c,m;
float y;
scanf(“%d”,&x);
if (________(1)________) c=-1;
else c=________(2)________ ;
switch (c) {
case –1 :y=0 ; break ;
case 0 :y=x ; break ;
case 1 :y=10 ; break ;
case 2 :
case 3 :y=-0.5*x+20 ; break ;
default :y=-2 ;
}
if (________(3)________)
printf (“y=%f”,y);
else
printf(“error!”);
}
人气:469 ℃ 时间:2020-06-08 03:24:02
解答
void writeto(link_stu H)
{
FILE *a;
link_stu p;
p=H->next;
a=fopen("stu.dat","w+");
fwrite(H,sizeof(lnode_stu),1,a);
while(p!=NULL)
{
fwrite(p,sizeof(lnode_stu),1,a);
p=p->next;
}
fclose(a);
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版