我想知道如何以及何时可以使用exit()
函数,如我书中的程序:
#include<stdio.h>
void main()
{
int goals;
printf("enter number of goals scored");
scanf("%d",&goals);
if(goals<=5)
goto sos;
else
{
printf("hehe");
exit( );
}
sos:
printf("to err is human");
}
当我运行它时,它显示错误:call to undefined function exit().
另外,我想知道如何创建一个选项来关闭程序运行的窗口?例如,我制作了一个菜单驱动的程序,它有几个选项,其中一个是"exit the menu".如何使其退出程序(即关闭窗口)?