You define the function val as int val(int); but inside main() you call the function like val(); // Missing a integer as a argument .
You are also not returning anything from your function val().
I would recommend you take a few hours and build a simple program (Even the hello world program) and make sure it compiles and runs just fine. Then start changing things to create errors in the program (Remember what you changed) and then compile it and see what errors the compiler gives you.
Then take note of these errors and what you changed that made that error. This will help you learn what the error codes mean and will save you trouble in the long run.