If your code doesn't return a value to the system, it gets a random number - and since a return value of zero is "OK exit" and any other value is an error code you always get an error from your app because you aren't returning anything specific.
So as steveb has said: add
return 0;
To the end of your app and the problem will go away.
But do yourself a favour and indent your code properly - that's a mess and it makes it much harder to read and maintain (or even fix) than it should be. You may understand it now, but in three weeks it'll be gobbledegook to you as well ...