toofaces2
PS3 Developer
Basics of C ++ and compiler
Learn C ++ programming is an option that is also still perceived by programming beginners.
Often one starts today with Java or C # as the first programming language.
But C ++ to learn still makes sense, since some concepts are included, which does not exist in Java and C #.
Although these concepts have lead to a higher error rate of C ++ - programs that give the programmer as well as greater control and allow more efficient and faster programs.
This C ++ - tutorial will give you a information and general overview of the language and to introduce some of the core elements of the language.
To learn properly then C ++ program.
C ++ learn programming - basics of the language
C ++ is a both imperative and object-oriented programming. Object orientation means (roughly speaking) that you try to model a program like in the "real" world with the help of objects that interact with each other. Imperatives programming means that you give the computer a set of instructions that specify the order in which that is done.
In contrast to "modern" programming languages like Java and C # exist in C ++ some concepts like manual memory management and pointer arithmetic, which are considered complex and error-prone. Therefore, it is probably especially for beginners often easier to first learn the basics of programming based on these other languages and then later go into C ++ with these complex concepts. Nevertheless, it is also still recommended to start directly with C ++, if you want to have a complete overview of elemantare components of programming immediately. It also allows C ++ to program more efficient programs, since the programmer has more control than in other programming languages.
The language C ++ is basically and theoretically platform independent. In practice, however, it is so that the functionality of C ++ is supplied largely by external libraries and these libraries are then but sometimes depending on the platform. As a rule, you can assume that you can not translate so readily on a Linux system is a program that you have programmed for Windows.
The advantage of this is again that you can program much closer system in
C ++ and so has access to specific system functions that remain hidden in an other programming.
Compiler and development environment
There are a ton of C ++ - Compiling and development environments that you can use if you want to learn programming. Known representatives freely available under the compilers have the
Borland compiler and the GNU compiler (under Windows, however a port as required MinGW). Simple but it is already at the start, if you are using an integrated development environment for programming. Here, there are paid tools, but also some free alternatives. In particular, Microsoft put a free Express version of its Visual Studio development environment available. Another free development environment for programming with C ++ is NetBeans.
The Obligatory "Hello,World"
In all its glory, the following code is the simplest C++ program you’re likely to encounter.
In all its glory, the following code is the simplest C++ program you’re likely to encounter.
C:
// helloworld.cpp
#include <iostream>
int main(int argc, char** argv)
{
std::cout << “Hello, World!” << std::endl;
return 0;
}
The first line of the program is a comment, a message that exists for the programmer only and is ignored by the compiler. In C++, there are two ways to delineate a comment. In the preceding example, two slashes indicate that whatever follows on that line is a comment.
C:
// helloworld.cpp
C:
/
* this is a multiline
* C-style comment. The
* compiler will ignore
* it.
*/
Preprocessor Directives
Building a C++ program is a three-step process. First, the code is run through a preprocessor, which recognizes metainformation about the code. Next, the code is compiled, or translated into machine-readable object files. Finally, the individual object files are linked together into a single application. Directives that are aimed at the preprocessor start with the # character, as in the line #include <iostream> in the previous example. In this case, an include directive tells the preprocessor to take everything from the iostream header file and make it available to the current file. The most common use of header files is to declare functions that will be defined elsewhere. Remember, a declaration tells the compiler how a function is called. A definition contains the actual code for the function. The iostream header declares the input and output mechanisms provided by C++. If the program did not include it, it would be unable to perform its only task of outputting text.
For more Information or Question Please feel free and PM me.
Credit: Nicholas A. SolterJohn Wiley & Sons(helloworld.cpp)
Last edited: