1 // Fig. 6.16: fig06_16.cpp
2 // Functions that take no arguments.
3 #include <iostream>
4 using std::cout;
5 using std::endl;
6
7 void function1(); // function that takes no arguments
8 void function2( void ); // function that takes no arguments
9
10 int main()
11 {
12 function1(); // call function1 with no arguments
13 function2(); // call function2 with no arguments
14 return 0; // indicates successful termination
15 } // end main
16
17 // function1 uses an empty parameter list to specify that
18 // the function receives no arguments
19 void function1()
20 {
21 cout << "function1 takes no arguments" << endl;
22 } // end function1
23
24 // function2 uses a void parameter list to specify that
25 // the function receives no arguments
26 void function2( void )
27 {
28 cout << "function2 also takes no arguments" << endl;
29 } // end function2