如何在C中按0来终止程序? [英] How to terminate a program by pressing 0 in C?
本文介绍了如何在C中按0来终止程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过按0来终止或关闭整个程序?
How can i terminate or close the whole program by pressing 0?
推荐答案
作为解决方案1的替代方案,请尝试:
As alternative to solution 1, try:
printf("please enter the divisor:");
if ( scanf("%d", &d) == 1)
printf("the quotient is %d\n", 1/d);
尝试:
Try:
if (charReadFromKeyboard == '0') exit(0);
这篇关于如何在C中按0来终止程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文