《C++ Primer Plus》中的问题
我正在学习C++,看得书是《C++ Primer Plus》,现在看到第二章就碰到问题了,程序清单2.5(代码如下),说的是用户定义的函数,可我无论怎么看这段代码都看不懂,return 0不在结尾怎么跑到中间去了程序还能通过编译?另外那个simon(3)又是怎么被调用的了?我就是觉得排版错了,可偏偏是我错了?请大家指教!谢谢!!!
// ourfunc.cpp -- defining your own function
#include <iostream>
void simon(int); // function prototype for simon()
int main()
{
using namespace std;
simon(3); // call the simon() function
cout << "Pick an integer: ";
int count;
cin >> count;
simon(count); // call it again
cout << "Done!" << endl;
return 0;
}
void simon(int n) // define the simon() function
{
using namespace std;
cout << "Simon says touch your toes " << n << " times." << endl;
} // void functions don't need return statements