Loading

C++: Creating a Console Application (2003)

Creating a Console Application (2003)

  1. Open Visual C++ 2003. Left-click 'File' in the menubar, mouse over 'New,' and left-click 'Project' in he submenu.
  2. This opens the 'New Project' dialog box. In the 'Project Types' box, left-click 'Visual C++ Projects' and inside the 'Templates' box, left-click 'Win32 Console Project.' Inside the 'Name' box, type 'ConsoleLesson1,' select the location for your project using the 'Browse' button, and finish by clicking the 'OK' button.
  3. This will open the 'Win32 Application Wizard.' Left-click 'Application Settings.' Then left-click the box next 'Empty Project' under 'Additional options:' and complete the wizard by clicking the 'Finish' button.
  4. Now, you have created an empty project. To put a code file in it, left-click 'Project' in the menubar and left-click 'Add New Item' in the submenu.
  5. This brings up the 'Add New Item' dialog. Left-click 'Visual C++' in the 'Categories' box, and left-click 'C++ File' in the 'Templates' box. In the 'Name' box, left-click and replace the text with 'main.cpp' and click the 'Open' button.
  6. There is now a tabbed pane labeled 'main.cpp.' In the pane, enter this code:


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

  8. To compile and execute the program, left-click 'Debug' in the menubar and left-click 'Start Without Debugging' in the submenu.
  9. A message box should appear asking whether you would like to build the project. Click 'Yes' and you should see the console window displaying the message 'Hello World!' when the compilation is finished.