return main ();
This line runs the function called
main
(it does not return to the start of main - it runs a whole new main function inside the one that is already running). Your code runs main over and over and over and over and over and over, each one nested inside an already running main function, going deeper and deeper and deeper and deeper... you get the picture.
Why are you running
main
within itself? What are you trying to do?
Your switch statement has no default case - what happens if you don't choose 0 or 1? Your case 0: code has no break statement, so if you choose 0, you will also run case 1.
That
return 0;
is directly after the
return main()
; when will
return 0;
ever be reached? (Never)
Did you mean to put
return 0;
inside
case 1:
? That's what you've done.
As an aside, use of
#include <conio.h>
is non-standard but not horrific. Use of
1 2
|
system ("PAUSE");
system ("cls");
| |
is completely system dependent and frankly a little dangerous; it surrenders control completely to an external programme.
Also, I note that you're able to use system without including the
cstdlib
header. This suggests a build environment that is not C++ standard compliant. Can you move to a better build environment (i.e. dump your IDE and get a modern one)? You will simply learn bad habits that will be hard to break, and when you try to use your code on a compliant system, you'll be confused as to why it doesn't work. I must admit I've never heard of "DevShed C++"; I thought DevShed was a programming forum and articles site.