Previous Lesson C++ Console Video Tutorials Main Next Lesson



Lesson 1: Creating a Console Application (2008)

Go to Lesson 1 for Visual Studio 2010
Go to Lesson 1 for Visual Studio 2003
If you cannot see the video below, please install the Adobe Flash Player.
 





Creating a Console Application (2008)




Our Visual C++ 2008 video tutorial builds on our Lesson 0 installation video. Assuming that you have already installed the IDE and opened it, you can run through the steps in this lesson to create your first program. If you have not installed Visual C++ 2008 Express, you can do so here:



  1. In the menubar, left-click 'File,' mouse over 'New,' and left-click 'Project.' This will pop up a dialog box.
  2. Left-click 'Win32' in the 'Project Type' box. Then left-click 'Win32 Console Application' in the 'Templates' box. Finally, left-click the text box next to 'Name' and replace the text there with 'ConsoleLesson1' and click the 'OK' button.
  3. This will bring the application wizard. Left-click the 'Next' button to go to 'Application Settings.' Check the box next to 'Empty project' under 'Additional options:' by left-clicking it. Then complete the wizard by left-clicking the 'Next' button.
  4. Now, we have an empty project. To put a code file in the project, left-click 'Project' and then left-click 'Add New Item' in the menubar.
  5. This will bring up the 'Add New Item' dialog box. Now, left-click 'Visual C++' in the 'Categories' box and then left-click 'C++ File (.cpp)' in the 'Templates' box. Finally, left-click the text box next to 'Name' and replace the text there with 'main.cpp' and click the 'Add' button.
  6. Enter the 'Hello World' code shown here into the 'main.cpp' tabbed pane.


  7. #include <iostream>
    
    int main() {
        std::cout << "Hello World!" << std::endl;
        return 0;
    }
    

  8. In the menubar, left-click 'Debug' and 'Start Without Debugging' to build and execute the program.
  9. You might see a dialog box stating that 'This project is out of date' and asking if you: 'Would like to build it?' You can click the 'Yes' button, but I recommend also checking the box next to 'Do not show this dialog again' to stop this from popping up every time you run.
  10. Now you should see the console window displaying the message 'Hello World!'




Previous Lesson C++ Console Video Tutorials Main Next Lesson


Home | Reference | Play Games! | Forum | Site Map | Contact Us