Hello @Hamza Rashid,
Welcome to Microsoft Q&A forum.
Instead of using a file or a folder, please try to create and use a project to build and run(debug) your program. One single file cannot be built or run in Visual Studio.
You can try to create a new project by using project templates that provided by VS, and type, edit the code in newly created project, then run your program.
If the code you have is from an existing project, try to get the whole project and open the project(File => Open => Project/Solution) in Visual Studio then run it.
Besides, it seems that the code you have(from the screenshot) is C#, but you want to use/run a C/C++ program? You may need to first confirm the programming language that you are going to use and select the correct project template. See following screenshots:
C#:
C++:
Here’s related documentations about
Create a C++ console app project in Visual Studio
Build and run a C++ console app project
Tutorial: Create a simple C# console app in Visual Studio
Sincerely,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.