Thursday, March 19, 2009

Tutorial: Learn All The Basics Of C++ Language:page 5

First while writing the program we should keep in minds that we should do less mistakes. So without wasting time I am giving the way how to write a program.
The following steps should be taken:-

Quote:
#include

void main()
{
//variable declarations
//program statement

getch();
}
Note: - After void main() ';' semicolon should not be placed other wise error will occur. Instead of void main() only main() can be used but at the end the program should return a value. Otherwise use void main() if u are a beginner.

Note:- Giving getch() is not an essential part of the program. It is only given to pause(rather waits for a keystroke ... more precisely your program is waiting for an input) after the completion of the program, since most people run the program pressing Ctrl+F9 and without it, it may seem to you that there was no output given.

No comments:

Post a Comment