Chapter/Index: Introduction | A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
K |
L |
M |
N |
O |
P |
Q |
R |
S |
T |
U |
V |
W |
X |
Y |
Z |
Appendix
MAIN Function in C++ and DM
MAIN() is the only function that any C++ program must include and is special because it is the first function called when your program executes. This function is also where program execution begins.
Table 1126. Examples main() function.
DM script |
Note |

Example |
◆ This script is to compute the factorial of an integer with recursive and iterative methods
◆ Lines 10 to 16: Recursive version
◆ Line 13: "return (1)" has the same function as "return 1"
◆ Lines 18 to 24: Iterative version
◆ Line 31: use the recursive version above
◆ Line 33: use the use iterative version version above
◆ void main () cannot be moved to the top of the script because the two functions, EMfactr() and EMfact(), have to be declared before they are called and used by main() |
|