Introduction: Creating Your First C++ Program Using the Visual Studio Express IDE
Introduction
The use of computer programs affects our everyday lives. Computers, smart phones, and tablets are all run by a program someone created. These programs range in difficulty depending on the goal of the task at hand. But there is one program every programmer must write (yes even the person who programmed your Iphone). In the computer science world this is called the Hello World program. In order to write this program, you must download an IDE. IDE stands for integrated development environment. Basically, an IDE gives you a place to write and run your program.
This Instructable walks you through how to install an IDE and create the first program every programmer must write. You will be writing this program in the C++ computer language using the Visual Studio Express IDE.
Materials
- A CD containing the Visual Studio Express 2012 software.
- A computer running the Windows 7 operating system.
Time and Cost
This Instructable should take about 30 minutes or less to complete. There is no cost involved.
NOTE: Please make sure you read every step fully before executing the instruction. Some of the steps may require you to anticipate what will happen next.
Step 1: Insert Disk Into Your Computer
Place the CD, containing the Visual Studio Express 2012 software, into your computer's disk drive.
Step 2: Open Folder to View Files
A small window should appear in the middle of your screen. Click on the "Open folder to view files" tab. This will take you to the files stored on the CD.
Note: If this window does not appear then click on the Window's start button (usually in the lower left hand corner of your desktop). Then click on the "Computer" tab on the right hand side of the pop up. Once that window appears, there will be a section called "Devices with Removable Storage". You should see an option for a DVD. Double click on that option to bring up the small window.
Step 3: Double Click on Wdexpress_full.exe
Run the .exe file by double clicking on the wdexpress_full.exe tab. This will launch the installation guide for Visual Studio Express 2012.
Step 4: Agree to the Terms and Conditions
When the installation window appears, click on the box next to the statement that reads, "I agree to the License terms and conditions." This is saying that you are allowing the software to be downloaded to your computer.
Step 5: Install Visual Studio Express 2012
After agreeing to the terms and conditions, the bottom "Install" tab will light up. Before clicking on this tab, please be aware that after clicking it a User Account Control window will appear. When this window appears, make sure to click on the yes tab. Now click on the "Install" tab, which will start the install process.
Step 6: Wait for Visual Studio Express 2012 to Install
Wait for the installation to complete. This may take several minutes.
Step 7: Launch Visual Studio Express 2012
Now that the install is complete you are ready to start programming. Click the "Launch" button in the lower portion of the screen. This will launch Visual Studio Express 2012.
Step 8: Register for Microsoft Visual Studio Express 2012
A new registration window may appear on the screen. If so, click on the Register online tab. This will take you to the online registration for the software. If this window does not appear you may skip to Step 15.
Step 9: Sign in With Microsoft Account
Sign in with your Microsoft Account (You might have an account if you have signed up for Xbox Live). If you do not have an account, click the Sign Up Now tab in the bottom right hand corner of the screen. If you click the Sign Up Now tab, walk through the setup and then move on to step 10.
Step 10: Continue With Registration
Select the country that you are currently residing in as well as the Personal option for the reason for use. After selecting both of those items, click on the Continue button in the bottom right hand corner.
Step 11: Select Private Use
When the next screen appears, select the option that says Private Use. Then after that has been selected, click Continue in the bottom right hand corner.
Step 12: Copy and Paste Product Key
A new screen will appear with the product key. Copy and paste this key into the registration window that appeared in step 8. To copy and paste, you can highlight the whole key and then use Ctrl-c to copy and then Ctrl-v to paste.
Step 13: Click Next
After pasting the product key into the text box, click the next tab in the lower right hand corner of the window. Stop!!! Please be aware that after clicking the next tab, a User Account Control window will appear in the
middle of your screen asking if you want to download this software onto your computer. Click the yes tab.
Step 14: Click Close
After clicking yes on the User Account Control Window, click close in the right hand corner of the registration window. This will now open Visual Studio Express 2012.
Step 15: Create a New Project
Now that Visual Studio has loaded, it is time to create a new project. Select the New Project... tab on the left side of the screen.
Step 16: Create a C++ Win32 Console Application
A new window will appear. There are two things that need to be selected in this window. First, on the left hand side select the tab that says Visual C++. Then in the middle of the screen select Win32 Console Application. These are both needed in order for the program to know the language that you will be writing in.
Step 17: Name Your Project
After selecting those two tabs, you now need to name your project. Lets name it: First_Program. After typing First_Program into the text field, click on the ok button in the lower right hand corner.
Step 18: Click Next
A new window will pop up. Select the next button in the lower right hand corner of this window.
Step 19: Create an Empty Project
A new window will appear with many options. Select the option that reads, Empty Project, under the additional options section. After clicking on that box, click the finish button in the lower right hand corner of the window. This should bring you to the project page.
Step 20: Press the Combination of Ctrl-Shift-A on the Keyboard
Now that you have created a new project it is time to create a source file. This is done by pressing the Ctrl-Shift-A combination on the keyboard. Once this combination is pressed, a window will appear.
Step 21: Create a .cpp File and Name It
Select the C++ File (.cpp) option at the top of the window. Then place the name, Hello_World.cpp, inside the name text field.
Step 22: Add the New File to Your Project
After you have selected the C++ File option and named your file, select the Add button in the lower right hand corner of the window. This is take you back to the project screen and add the .cpp file to your project.
Step 23: Copy and Paste the Code
Now you are ready to write your first program. Copy and paste the following code into the text editor portion of the page (the text editor is in the center of the screen). Make sure that your code looks exactly like the code below:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!!!!!!!!\n";
return 0;
}
Step 24: Press Ctrl-F5 on the Keyboard
Once you have written out your code completely, press Ctrl-F5 on the keyboard. This runs your code in what is called a complier.
Step 25: Select the Yes Tab
After pressing Ctrl-F5 a window will appear. Select the Yes tab.
Step 26: DONE
Congratulations!! You have just completed your first program. Hopefully your output looks the same as the output above. If it doesn't, then go back to Step 23 and make sure you have copied the code correctly.
You should have a sense of accomplishment about what you have done. You have downloaded software onto your computer, created a new programming project within that software, and wrote your first piece of C++ code. Being able to master these steps can prove to be extremely helpful throughout your life. For more information about getting started in the programming and learning more about computer science please see the links below.
http://www.cprogramming.com/begin.html