31/08/2018
An Introduction | C++ Programming | C++ Crash Course
Objective: Get a brief introduction, history, and understanding of the C++ language.
C++ is widely known as a low-level, advanced language that every programmer should know. One main difference between C and C++ is object-oriented programming (OOP). The OOP side of C++ is probably makes it much more difficult to understand and learn. This Tutorial is meant to help new programmers with the language, including help with OOP methodologies and structures.
A Brief History of C++
The C++ language first appeared in the 1980s. It was created by a Danish computer scientist named Bjarne Stroustrup. The original name for the language was “C with Classes,” but was later changed to C++. The main original purpose for C++ was adding OOP to the older C language.
As the years went on, C++ evolved and was standardized. C++ was created as a low-level language, which means that it works closes to binary level programming. As a matter of fact, the language was originally created to work only one step above binary or assembly language. The closer a language is to actual machine language makes it faster and more flexible with low-level machine manipulation such as memory processing and storage.
What is C++ Used For?
The single most basic reason developers still use a language that’s over 30 years old is performance. Remember that languages that are closer to the binary computer language are always faster than bulky overhead languages such as Java, C # or VB. The latter three languages still have their uses, but C++ is mostly used for programming where alternative languages are unable to fully cover aspects of development.
As a new developer, the world is your horizon and you can use any language you want. However, there are some industries where you won’t be able to use any language other than C++. The C++ language is engrained in several areas of IT and software development.
SIMPLE ADDRESS BOOK ( ADA Mini Project )
Gaming is probably the number one area of IT where you’ll need to know C++. C++ is used to create gaming engines. Other languages are too bulky and waste resources. Since gaming engines are concerned with speed and quality of rendering, C++ is the language used for low-level programming in gaming design. It’s usually coded along with other languages in gaming design, so it helps a developer to understand multiple languages when getting into game programming.
Device drivers are almost exclusively done in C++. C is used in embedded systems, but the drivers used to integrate hardware with larger systems such as desktops, servers and mobile devices are all
coded with C++. Device drivers are the software programs used to allow the hardware component to work with an operating system. Device drivers are specific to the operating system, but C++ works across any platform. Device driver writers use C++ for its speed and platform-independent integration. Once compiled, the program is specific to the operating system, but you can use C++ to write for Linux, Windows, and Apple systems.
Imaging and video processing software uses C++. It’s again used for its speed. It can take days to render an image or video with slow hardware and software. C++ overcomes much of the bulky overhead of other languages. Similar to gaming development, the imaging and video rendering industries also prefer C++.
The telecom and networking industries use C++ to code the hardware necessary for communication. Routers, voice systems such as PBXes, hubs, and switches use C++ as the backend coding language. Network engineers usually have a firm grasp of the C++ language, especially those who build hardware systems.
Finally, we mentioned C is used in embedded systems, which is the standard. However, some embedded system designs use C++ instead. C++ has a bit more overhead than its predecessor C, so it’s not usually preferred. But C++ offers more options and libraries than C, so it’s needed in more complex systems.
Financial systems and analysis rely heavily on C++ for its speed and precision. If you play the stock market, you’re relying on systems and number crunching controlled by C++ programming.
Why Use C++?
Most new programmers are confused between the differences of C++ and C. They don’t know when to use the C++ language over C, or any language for that matter.
The main difference with C++ is its use of object-oriented programming. This isn’t capable with the C language. This does not make the C language inferior, it just makes C++ accessible to additional libraries and coding possibilities.
With object-oriented programming, you can use constructors and destructors. A constructor instantiates the class and a destructor removes it from memory. We’ll learn about these concepts in future chapters.
Java developers sometimes switch to C++ programming. Java is a language similar to C++ but it’s a much higher level language that isn’t compiled. Java is an interpreter that runs on any platform, but it can be much slower than the C++ language.
Overall, the main reason to use C++ is for speed. If you ever want to get into very low-level, fast coding that handles memory functions much more efficiently, you want to use C++. This Tutorial attempts to give a new programmer and introduction to the language.
What You Need to Code in C++
C++ is a compiled language, which means that you need a compiler before you can complete the coding process. You could type the code in a regular text file, but it’s not recommended and you’ll still need a compiler even if you do write perfect code with no errors. Remember that compiled languages depend on the operating system on which they are compiled. This means that if you compile your code on a Windows machine, the software will only work with Windows. You’ll need to code your program on another operating system for it to work on a different system.
A simple Google search will help you find a compiler that suits you. Some compilers are made for both Linux and Windows. Others work on only one platform. Once you choose your compiler, you need to store it in a directory on your machine.
You also need an IDE. The IDE is what you code in. It gives you the color coded text interface that helps you write better code. The color coded text lets you quickly identify data types, comments, classes, and other common code structures. In other words, it makes it easier to read. Most compilers come with an IDE, so check this out before you install the IDE.
Once you determine which compiler and IDE that you want to use, you then need to install it on your system. The IDE should have an EXE or MSI package for you to just automatically install the software without using any command lines. If you’re using a Linux based system, you probably need some extra configurations.
After you install the software, open the compiler to get a feel for how it works. You’ll be working directly in the C++ IDE, so get a feel for the color coding. For instance, comments are usually displayed in green text. A data type is set in a blue color. Classes are color coded in blue as well. Strings are either red or blue. Standard variables including your function names are in black.
At the bottom of the IDE, you’ll see the build log and debugger. These are two windows that are most important for your programming success. The build log tells you if any errors occurred when the C++ compiler created the executable, compiled program. The debugger is used when you want to step through the code and identify which part of the code is causing you errors.
Some IDEs have a “to do” list. A to do list is a set of code blocks set with TODO in the comments.
This tells the coder that he needs to work more with the code, and he’s not finished.
If the IDE developer is kind, you start with a temporary Hello World program when you first run the program. This can be compiled and displayed in the console, so you can see the way the compiler and the language work. Also note that C++ coding files end with the .cpp file extension. This is important when you’re searching your hard drive for the necessary coding files for your program.
What You’ll Learn in This Tutorial
The goal for us is to get you acclimated as a new programmer in C++. C++ is a massive language, but you can take the beginning concepts and turn into an advanced programmer with some practice. We’re giving you the toolset, and you can use it to work with the more complex procedures.
In the first lesson, we’ll introduce you to the basics of C++. You’ll need to know the basic structures and programming concepts before you begin actual coding.
Next, we’ll give you an introduction to variable data types and what you can do to call certain variables. Variables are used in any programming language, so once you learn one language, you’ll easily learn any others.
Next, we’ll learn about operators and how to perform arithmetic with your C++ programs. We then get into advanced data types, and what you can do to convert from one data type to another. We also introduce you to the string class, which is different from the primitive string or character data type.
We then go into the loops and conditional programming structures. These are also very popular in any programming language. Loops and conditional statements control the way a program executes.
Getting a little more complex, we then get into arrays. Arrays are a bit more complex, but they are necessary in any language. Even low level languages such as C use arrays intensely.
One of the most difficult parts to learn in the C+ language is object-oriented programming. OOP is much different than standard linear languages. OOP creates components out of your code, so you can code in a compartmental fashion.
With OOP, you need to know inheritance, which is the concept of using parent structures for reusable code. Inheritance is another commo
http://hadotigroup.com/an-introduction-c-programming-c-crash-course/
krishna