C++ Course Language |
Learn to program in C++ by taking online courses or using the reccomended book titles. C++ is a very strong object oriented language to develop simple to complex programs. Expert articles on tutorials and language are available.
Featured Article on C++ Tutorial and Programming
Introduction to C++
Why Learn C++?
C++ may at first seem like a boring, confusing programming language that you can only program command prompt applications with. Well, that is what it is like in the [b]begining[/b]. And you are going to need to learn the basics like this with any programming language. As you get better and progress in your C++ skills, you will begin to learn that you can start making some cool applications easier than you thought you could. The main reason to learn C++ though, is that it teaches all the basics of programming and you will learn concepts that will be used in other types of programming. Many other programming languages are like C++ or use C++. For example, PHP, a powerful web development language uses almost the same syntaxes as C++. DirectX, a common game development graphics library primarily uses C++.
Setting up C++
Ill assume that most people are not going to want to spend the money for a compiler, thats fine, there are many great free compilers. I use Dev-C++ because it has some nice features and is fast, and best of all, its FREE!
http://www.bloodshed.net/dev/devcpp.html
You can download it here.Download it and install it, this step is pretty easy. During instillation, select all the deafult values during instillation.
Create a New Project: Go to the top menu: File -> New -> Source File, or just press Ctrl+N
You should now have a text document. Then, write the following text in the document:
#include
using namespace std;
int main() {
cout<<"Hello World!";
cin.get(); }
I would suggest typing it instead of copying it, you will get alot more out of actually typing it rather than copying it, because you get used to the syntaxes and development.
Run the Application: Now that you have your first C++ Application, [b]Press F9 [/b] to compile and run it. If you did everything right, it should open a command prompt like application and say 'Hello World' or whatever you told it to say. If it doesnt, look over the code and make sure everything is correct.
Code Analysis
#include Tells the compiler that we are going to be using the iostream library, which includes information on things we will be using in the code.
using namespace std; Saves time by telling the compiler that we are going to be using the 'std::' functions, which stands for 'standard'.
int main() Starts the main function, this is were the heart of the program is. I will get into what functions are later on.
{ Starts the main function.
cout<<"Hello World!";[/code] Writes "Hello World!" to the screen. cout stands for 'console output.'
cin.get();[/code] Gets a variable from the user, we wont really be using this, but it is what will keep our application from being closed really quick.
} Closes our main function.
Analysis: Now that we have made a simple C++ Application, we will start getting into more advanced topics so you can start making useful applications.
Chris Silop - Computer Forum
This is the tutorial where we really get into programming. Input and variables are the essence of programming. In this tutorial you will learn how to get data from the user and use variables. You will learn the types of variables there are and how to do basic math with them. At first, this may seem boring and pointless, but you have to learn it, and it should go quick.
Basic Input When you are making a console application, here is how you should get user input. Some of you may have guessed it, you use c[b]in[/b], of course, the 'c' meaning console and the 'in' meaning input, like 'cout'. So, here is a basic code, where the name of the variable x. cin>>x;
Defining Variables A variable is what you guessed, a number or piece of data that will vary.
The diffrent types of variables:
bool - true or false int - whole numbers char - character (a, b, c, etc...) string - multiple characters (words, etc..) float,double - numbers that can have decimals
When deciding what type of variable to use, think about what kind of data it is going to be storing and remember that some data types use more memory than others, however most of your applications will use less memory than you have. To declare a variable, write the type of variable, then the name.
Examples: int myInt = 7; char thisChar= 'a', otherChar = 'b', char newChar; string password= "password";
Syntaxes Notice how I always had the first word not capatalized, but I capatalized all the other ones. You can also define more than one at a time, and you dont always need to set the value in the begining. Also, when you use a char, use a ' and for a string a ". Try to give your variables meaningful names.
Math This is really the heart of programming, math! For now, we are going to be doing some simple arithmetic.
The basic math functions are:
+ = addition - = subtraction / = division * = multiplication
There are a bunch more, but that is all we need for now.
Go out and make a program!
Now that you know some of that basic stuff, try making a program, and dont be afraid to ask for help on http://www.syschat.com!
Chris Silop - Computer Forum
C++ Course - C++ Jobs - Java Programming - MCSA - MCSD - IT Courses - Home