exit function : is terminates entire program. Here it is used in for loop when the value of i is eqauls to 100 then exit(0) will be executed and the program will be terminated.
#include<iostream.h>
#include<conio.h>
#include<process.h> // requires to include for exit() function
main()
{
clrscr();
for (int i=1;i<=100; i++)
{
cout << i <<endl;
if (i==30)
exit(0); // it will termiate entire program
}
cout << "hello" <<endl; // this statement will never execute.
getch();
}
Mar 26, 2007
Exit() function in C++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment