Also see this thread:
https://learn.microsoft.com/en-us/answers/questions/494574/visual-studio-not-creating-exe-for-c-program.html
Note that VS creates exe files by building projects. You can't
just open a CPP file in the IDE editor and Build or Run and
expect the code you are looking at to be part of the project that
creates the exe. It must be a source file shown for the project
in the Solution Explorer.
You haven't said anything about how you created the project - if
at all - and how you added your code to that project. One way
is to right-click on the Source node in the project tree in the
Solution Explorer and choose Add to make a new or existing CPP
file part of that project.
Another is to use the appropriate Project Template such as
"Win32 Console" and modify the source file that it creates
automatically.
Always do a Build or Rebuild first before trying to Run the
program. Fix all errors and warnings shown in the Build
window before trying to Run the program. Always start
fixing errors from the top down - fix the first error,
then the next, etc. Don't just look at the last error and
wonder why it occurred - errors often cascade and later
errors happen because of prior errors. Often fixing one
error can clear up many subsequent error messages.
If the Build shows errors that you don'r understand,
show them here and the code that caused them (copy
& paste actual code, don't try to retype it in a post
as that often leads to errors or omissions).