C++ Programming Tutorials – 1 – Intro to C++ and Hello World Program – Eric Liang

Hello and welcome, today I’m going to be showing you how to program in C++. My name is Eric. Before we can actually start programming in C++, we must first download a program called an “IDE” which stands for “Integrated Development Environment” now, the IDE that we’re going to be using today is called “Visual Studio” So head on over to visualstudio.com Under their “Downloads” tab, go to Visual Studio Downloads Scroll down until you reach the Visual Studio Express section. Download the Visual C++ Express or you can download the Visual Studio Express Either one is fine. It’s just that the Visual Studio has all four of these components inside, while the C++ Express just deals with C++ alone. Now I’m going to be using Visual Studio. If you are a student, be sure to head on over to dreamspark.com and download it from there instead because at Dreamspark.com, is where you can get the software for free and it has all the features in the full edition of the program. Don’t worry, the Express edition is also free. Now, I’m going to assume that you know how to install a program, so I’m going to be skipping the setup part. Once you have the program installed, just head on over to the icon, and launch it. Head on over to “File”, “New”, “New Project”. Select Visual C++, and choose “Win32 Console Application”. GIve your project a name. I’m going to name my project “Hello World”. Choose a location to save the project to. I’m saving it to my Desktop, and click OK. Click “Next”. Select “Empty Project”. Click “Finish” Now, on the right hand side, there should be a window called “Solution Explorer” Now if you don’t see it, head on over to the top and click “View”, and select “Solution Explorer” Or you can click Ctrl + Alt + L Now once you have that open, head on over to the Solution Explorer, and under the Source Files folder Right click it and Add, New Item. Choose the .cpp file under Visual C++. Now, let’s give it a name, any name will do. I’ll call it “main.cpp”. Click Add. Now wer’ going to be given this blank file. Let’s type in the following. #includeusing namespace std; int main() {} return 0; cin.get() before the return 0; line. For every line of code, or statements, you need to make sure you have a semicolon after it. Otherwise, it will not work. Now what you see here so far is the basic setup necessary to get a C++ program up and running. So, if you want, you can save this code into a separate file so you can always copy and paste it in whenever you start a new project… Now, for every program, there must be and only be one function called “main()” because it’s a requirement. Hey, I didn’t make up the rules for this so Now, let’s continue with our Hello World program. cout

Leave a Reply

Your email address will not be published. Required fields are marked *