#include#includemain(){doubledata1,data2;//把他们设成double就可以做
浮点运算了charop;do{printf("pleaseentertheexpression:");scanf("%lf%c%lf",&data1,&op,&data2);//在他们之间加空格就可以打无限空格了switch(op){case'+':printf("%.2lf+%.2lf=%.2lf\n",data1,data2,data1+data2);break;case'-':printf("%.2lf-%.2lf=%.2lf\n",data1,data2,data1-data2);break;case'*':printf("%.2lf*%.2lf=%.2lf\n",data1,data2,data1*data2);break;case'/':if(!data2)printf("divisionbyzsro!\n");elseprintf("%.2lf/%.2lf=%.2lf\n",data1,data2,data1/data2);break;default:printf("Unkownoperator!\n");}printf("Doyouwanttocontinue(Y/Nory/n)");fflush(stdin);//这是清掉之前的
回车键用的}while(toupper(getchar())=='Y');//你的底这样好这个应该没有问题了吧。}