#include<stdio.h>
float ser(float,float);
float par(float,float);
main()
{
float x1,x2,y1,y2;
char x,y;
do
{
printf("x1=");
scanf("%f",&x1);
printf("x2=");
scanf("%f",&x2);
printf("s or p");
scanf("%c",&x);
if(x=='s')
{
y1=ser(x1,x2);
printf("%f",y1);
}
else
{
y2=par(x1,x2);
printf("%f",y2);
}
printf("\n");
printf("Again y/n");
scanf("%c",&y);
}
while(y=='y');
printf("Exit!!");
getchar();
getchar();
}
float ser(float a,float b)
{
float c;
c=a+b;
return(c);
}
float par(float d,float e)
{
float f;
f=d*e/(d+e);
return(f);
}
结果,不能读入变量x,只进行了else部分的(如图,在s or p 后面直接跟else执行后的结果了),求详解,答得好再加分!