jun-csbio / CClass_ZJUT

CClass_ZJUT
1 stars 0 forks source link

如何实现计算机的重复使用 #24

Open yanggetars opened 1 year ago

yanggetars commented 1 year ago

写完的计算机用一次就会直接退出

Image_1695726222655

18957478816 commented 1 year ago

in main() { while (1) { …… …… } return 0; } 这是个死循环,程序用完要关掉,不然修改代码后编译不了

sq4250 commented 1 year ago

也可以用for循环决定算几次:

include

char a;double x,y; int main() { for(int i=0;i<10;i++){ scanf("%lf%c%lf",&x,&a,&y); switch (a) { case '+':printf("%lf+%lf=%lf\n",x,y,x+y);break; case '-':printf("%lf-%lf=%lf\n",x,y,x-y);break; case '':printf("%lf%lf=%lf\n",x,y,x*y);break; case '/':printf("%lf/%lf=%lf\n",x,y,x/y);break; default:printf("Error!\n"); } } return 0; }

Flyces commented 1 year ago

把在return 0;上一排加上一个main();

sq4250 commented 1 year ago

把在return 0;上一排加上一个main();

套(套(套(...套(娃www...))))