问题遇到的现象和发生背景
初学者自己编辑的一个程序,软件没有报错,但是运行没有结果,直接显示“按任意键继续. . .”
用代码块功能插入代码,请勿粘贴截
#include <stdio.h>
void man()
{
float c,d,e;
char a,b,f='v';
printf("wellcome!\n --> Do you want to enter this program?(please input yes or no.)");
scanf("%c",&a);
if(a=='yes')
{
while(f!='end')
{
printf("Please input sign of arithmetic.(+,-,*,/)\n\a");
scanf("%C",&b);
printf("please input number of a and b.\n");
scanf("%f %f",&c,&d);
if(b='+')
{
e=c+d;
printf("the answer is %f",e);
}
if(b='-')
{
e=c-d;
printf("the answer is %f",e);
}
if(b='*')
{
e=c*d;
printf("the answer is %f",e);
}
if(b='/')
{
if(d!=0)
{
e=c/d;
printf("the answer is %f",e);
}
else
printf("error!");
printf("if you want to end ,please input 'end'.\n");
scanf("%c",&f);
}
}
}
printf("ending\n ");
}
运行结果及报错内容
未运行,直接显示“按任意键继续”