题目内容

阅读以下程序,按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。计算输入的两个数的和与差:定义函数sum_diff(float op1, float op2, float *psum, float *pdiff),其中 op1 和 op2 是输入的两个数,*psum 和*pdiff 是计算得出的和与差。#include void sum_diff(float op1, float op2, float *psum, float *pdiff);int main (void){float op1, op2, sum, diff;void sum_diff(float op1, float op2, float *psum, float *pdiff);printf(“input op1 and op2: “);scanf(“%f%f”, &op1, &op2);________;printf(“%f+%f=%f; %f-%f=%f \n”,op1,op2,sum,op1,op2,diff);return 0;}void sum_diff(float op1, float op2, float *psum, float *pdiff){________ = op1 + op2;________= op1 – op2;}

查看答案
更多问题

阅读以下程序,按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。已建立学生信息链表(学号存于num域中,姓名存于name域中,成绩存于score域中),下列函数用于遍历链表并显示结点信息。void Print_Stu_Doc(struct stud_node *head){struct stud_node *ptr;if(________){printf("No Records\n");return;}for(ptr=head; ________; ________)printf("%d\t%s\t%d\n ",ptr->num,ptr->name,ptr->score);printf("\n");}

以下程序的功能是利用指针指向3个整型变量,并通过指针运算找出3个数中的最大值,输出到屏幕上。请填空。#include#includeint main(void){int x,y,z,max,*px,*py,*pz,*pmax;scanf("%d%d%d",&x,&y,&z);px=&x;py=&y;pz=&z;pmax=&max;________;if(________) *pmax=*py;if(________) *pmax=*pz;printf("max=%d\n",max);return 0;}

以下函数用于将链表中各结点的数据依次输出。请填空。struct student {long data;struct student *next;};void print(struct student *head){struct student *p ;p=head;if(________)//;链表不为空do {printf("%ld\n”, p->data);________;} while (________);}

已建立学生“高级语言程序设计”课程的成绩链表(成绩存于score域中,学号存于num域中), 下列函数用于输出不及格学生的学号和成绩,及补考学生人数。请填空。void require(struct student *head){struct student *p;long x;if( head != NULL){x=0;________;while(p != NULL){if(________ ){printf(”%7d %6.1f\n”, p->num, p->score);x++;}________;}printf(”%ld\n”, x);}

答案查题题库