题目内容

以下程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并做为函数值返回。请填空#define N 3 struct SS{ int num;char nam[10]; char sex;}; int fun(struct SS person[]) { int i,n=0; for(i=0;i

查看答案
更多问题

求平面坐标上两点间的距离。(开平方根用函数sqrt),程序填空#include #include struct point{ double x; double y;};double dist(struct point p1,struct point p2){ return sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y));}int main(){ struct point m,n; double dis; printf("请输入第一个点m的(x,y)坐标:"); scanf("%lf%lf", &m.x, &m.y); printf("请输入第二个点n的(x,y)坐标:"); scanf("%lf%lf",________, _________); dis=______________; printf("两点的距离为:%lf\d",dis);}

以下程序的输出结果是_________________#include #includestruct info{ int k;char *s; }t;void f(struct info t){ t.k=1997; t.s="Borland";}int main(){ t.k=2000; t.s="Inprise"; f(t); printf("%d%s\n",t.k,t.s);}

以下程序的输出结果为__________________#include struct st{int x,y;} data[2]={1,10,2,20};int main(){struct st *p=data;printf("%d",p->y);printf("%d",(++p)->x);return 0;}

#includestruct NODE{int num;struct NODE *next;};int main( ){struct NODE *p,*q,*r;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(sizeof(struct NODE));p->num=10; q->num=20; r->num=30;p->next=q;q->next=r;r->next=NULL;printf("%d",p->next->next->num);}

答案查题题库