microsoft visual c(part2)

Upload: hairil-hanif

Post on 05-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Microsoft Visual C(Part2)

    1/3

    Microsoft Visual C++ 6.0

    Creating a Simple "Hello, World" Console Application

    This tutorial is meant to be a very brief introduction to the Microsoft Visual C++ Integrated

    Development Environment (IDE). It is a simple step by step walk-through of the process ofcompiling a console program with VC++ 6.0 on a WinNT machine.

    Step 1- Starting VC++

    Double-click on the Microsoft Visual C++ icon on the desk top, or use the start menu to

    launch Microsoft Visual Studio 6.0->Microsoft Visual C++ 6.0. It will come up as anempty window with pull down menus across the top, and a tool bar underneath the menu

    bar.

    Step 2- Creating a Project

    All programming in Visual C++ requires using a project to enable the IDE to correctly linkall the needed modules. We will set up a project to ensure that the options are what we

    want. Select File|New from the menu. The "New" dialog box will appear.

  • 8/2/2019 Microsoft Visual C(Part2)

    2/3

    Ensure that the "Projects" tab is selected. From the list at the left, select "Win32 Console

    Application." In the Location text box on the right, type the name of the directory you wish

    to create this project's directory in. Alternately, you may select the base directory from adialog box by selecting the "..." button to the right of the text box. Type in a name for the

    project in the textbox "Project Name". As you type, notice that the project's name is added

    to the directory in the directory text box. VC++ will automatically create a new directorywith the same name as your project in the base directory.

    Select OK to set up the project. Click OK on the next two screens.

    Step 3 - Creating your source file

    VC++ will return to the startup screen, but will add two tabs ("Classview" and "FileView")

    to the leftmost window. You will need to add any source files needed for your project.

    Select "Project|Add to Project|New" from the menu. This will bring up the "New" dialogbox again, only this time the "Files" tab will be selected.

  • 8/2/2019 Microsoft Visual C(Part2)

    3/3

    Select "C++ Source File" from the list at the left. Enter a name for the file in the "File

    name" text box. Press OK to create the blank file.

    Step 4 - Enter the program

    Now you can enter the code for a Hello world program that uses the standard string class.

    You might try:

    #include < iostream >

    #include < string >

    using namespace std;

    int main() {

    string Greeting;

    Greeting = "Hello, World!!";cout