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();
}
Most Popular Articles
- How to create picture package in Photoshop
- How to change financial year in Tally
- How to set classic start menu in Windows XP
- Pyramid of stars in C (center aligned)
- Exit function in C
- Create a bacground for your image in Photoshop
- C program to generage a beep sound
- How to create bookmark in Microsoft Word
- How to compile and run JAVA programs
- C program to add subtract multiply and division
- How to format Nokia 6600 mobile phone
- JAVA Applet program for doing simple calculations
- How to Improve Windows Vista performance
- C program to add two given numbers






0 comments:
Post a Comment