Your First Program
These instructions will take you through the process of creating and running a simple program. Displaying the words “Hello, world!” on the screen is a traditional first step when learning a new programming language. You will use the Microsoft Visual Studio integrated development environment to write a source code file in C++, then build and run the corresponding executable file.
If you haven't already, follow the steps in Starting a New Project to create a new project and source code file.
To create and run your program:
Type the C++ code that appears below, but without the line numbers on the left. (Note: The last word on Line 10 ends with a lower-case ‘L’, not the number one.)
1// Program : "Hello, World!" in C++ 2// Author : Type your name here 3// Date : Fall 2025 4// Description: This program displays a greeting to the user. 5 6#include <iostream> // provides std::cout, std::endl 7 8int main() 9{ 10 std::cout << "Hello, world!" << std::endl; 11}- When you have finished, select “Start Without Debugging” from the Debug menu to run your program.
- If you see a message indicating that the project is out of date and asking if you'd like to build it, press “Yes”.
- If you've typed everything correctly, the program will start running and you'll see the words “Hello, world!” displayed in a console window.
Congratulations! Proceed to Step 6; otherwise, continue with Step 5.

If you are instead greeted with a message indicating that there were build errors, press “No” (there's no need to try and run the last successful build) and you'll see a list of error messages.
- Carefully check what you've typed against the code that was given. Use the line number indicated by the very first error as a guide to tracking down the source of the problem (the problem may be due to something typed on that line, or a line above).
- Once you've fixed the first error, select “Start Without Debugging” to try again.
- If you get stuck, and cannot get a particular error to go away, ask your instructor or a classmate for assistance.
- After you see the words “Hello, world!” on the screen, close the console window and edit the program so it displays a more personal greeting — e.g., “Hello, Casey!” (assuming that your name is Casey).
- Run your program again and verify that it works as expected. You should now see the personalized greeting message with your name.
Congratulations, you've completed your first CISP 301 program!