以下程序的输出 结果是_______________struct info { int b; int p;}; void f(struct info c) { c.b=3; c.p=4;}int main(){ struct info a={1,2}; f(a); printf("%d%d\n",a.b,a.p);}
查看答案
以下程序输出结果是___________#includestruct Person{int no;char sex;};void func1(struct Person per2){per2.no=6001;per2.sex='M';}void func2(struct Person *ptr){ptr->no=6002;ptr->sex='M';}int main(){struct Person per1={5001,'F'};func1(per1);printf("%d,%c\n",per1.no,per1.sex);func2(&per1);printf("%d,%c\n",per1.no,per1.sex);return 0;}
定义一个结构类型,要求输入一个学生的数学和计算机两门课的成绩,然后计算并输出其平均成绩。请填空。int main(){struct student{int math,computer;}stu;printf("请输入分数: ");scanf("%d%d",&stu.math,&stu.computer);printf("平均分是:%f ",(__填空__)/2.0);}
以下程序中函数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);}