>but when i try to run the program, visual studio displayed
>a message saying that the location file could not be found.
Still too vague. First, you posted two programs, but you didn't specify which one is giving you the problem. Second, you're not using any file I/O in your program, which means the error is coming from something less obvious. I'd wager a guess that it has to do with how you've set up the source files in a multi-file project, but I can't really say unless you paste the exact error instead of paraphrasing.