The compiler looks at your code only once, reading from the top down, in order.
When you write your call to main, the compiler doesn't yet know that it exists -- and so it immediately complains. In order to solve that problem, you will need to tell the compiler that main() exists before you use it.
Since your functions are mutually recursive, you need to introduce a function declaration (sometimes a "prototype") before it's been used.
Add the line
int main();
somewhere before the definition of
again()
on line 9.
Unfortunately, this is all moot, because you
must not call the main function in C++.
Quoting ISO/IEC 14882:2011, 3.6.1 [basic.start.main]:
The function main shall not be used within a program. The linkage (3.5) of main is implementation-defined. A program that defines main as deleted or that declares main to be inline, static, or constexpr is ill-formed. |
The standard uses the wording
shall,
shall not to indicate requirements or prohibitions.
So the solution is to use a loop instead of recursively invoking
main()
.