Useful Tips

Lessons C

Pin
Send
Share
Send
Send


People who have a desire start learning c ++ programmingoften ask such questions on the net:

  • What is needed for programming in C ++
  • What programs are needed for programming in C ++
  • How to start programming in C ++

However, the answer to one of the questions raises more questions. On this page I will try to answer them and tell in more detail.

The C ++ programming language is very popular and used. Applications written in this language use system calls of the operating system directly without interlayers. This, in turn, saves computer resources and affects performance. Programs written in C ++ are renowned for their speed.

IDE for Windows

Visual studio. The most popular for Windows is Visual Studio (you can download Visual Studio Express for free on the official Microsoft website). It has everything you need and even more, this monster weighs several gigabytes, while it slows down on slow computers.

Dev-c ++. The best option for programming is the Dev-C ++ IDE, there is everything you need to start, it weighs about 50 megabytes. Simple interface, easy to understand. You can download it here.

C ++ Lessons from scratch / Lesson # 1 - Basics

Useful links:

C ++ takes the basis in the C language, which was actively developed back in 1969-1973. The company was responsible for the development Bell labs led by chief developer Dennis Ritchie. After 10 years, Danish programmer Bjarne Stroustrup, who was once a C developer, is releasing an extended version of the language called C ++. At the beginning of its path, C ++ was just an extension, a kind of addition to C, which expanded the capabilities of OOP. Straustrup himself initially regarded the language as simply “ C with classes ».

C ++ was born in 1983. Although it was not a full-fledged language, it was only a branch of C, but still had a number of useful functions. Due to them, programmers were able to develop applications faster and easier. With the release of C ++, a number of currently common concepts have appeared in the world:

  • Initiation of classes with objects in OOP,
  • The principle of inheritance
  • Unloading or deleting functions from memory,
  • Virtual work functions,
  • Exception system and more.

It will be interesting: C to this day remains popular even despite the development of C ++ and the dominant position of the latter language in the field of functionality. Why is the old and less developed language even popular today? It's simple - porting programs to a new language is a rather costly and time consuming task. Some companies simply go with the flow and continue to support their C programs.

On the net, many experts give advice that it is better to start learning C-like languages ​​with C. They say that this is the only way to better understand the essence of C ++. In reality, this is a wrong opinion. If you start learning with C ++, in the arsenal of the developer there will be knowledge about the newer and modern features of the language. If one day it becomes necessary to switch to C, it will not require much time and effort. Even the fact of the need to switch to a rather old C is already in serious doubt.

You can read more about the language on this page.

In speed after the release of C ++, the language began to conquer various areas of programming. Gradually, new functions were introduced into it, which further removed him from the role of an addition to C. Years later, it was no longer considered extension or extension, and it was time to completely separate from C, then the language was called C ++. Since then, the path of languages ​​has diverged, they have become independent (as much as possible).

Today C ++ is a functional and powerful language that C inherited from a host of key memory management capabilities. For this reason, it is actively used in system programming.

Several areas of use:

  • Development of operating systems. Even Windows itself is predominantly based on C ++,
  • Driver creation,
  • Writing programs from scratch,
  • Development and support of antivirus applications and more.

C ++ went far beyond exclusively system programming. He can participate in the creation of applications at all levels, in which there is an emphasis on speed and work under high loads. It is used to form graphic editors and application applications.

A lot of game engines designed to render a huge game world are based on C ++. Over the past years, more and more mobile applications use this language. Even in the field of the web there was a place for this language. All kinds of web applications actively use C ++, not necessarily as a basis, maybe just to implement auxiliary functions, but the fact remains. To summarize: it is more difficult to find areas in which C ++ cannot be applied than where this language is used.

C ++ refers to compiled languages, that is, the compiler modifies C ++ code, transforming it into a machine using predefined instructions. All platforms differ in some features, because of which it is impossible to take and transfer the program from one to another platform. More precisely, you can transfer, but it will not start there. In this case, the source code of the application is mainly ported. The only exception is the use of the specific features of a particular OS.

C ++ has compilers and tools for working with code on most well-known platforms. This allows you to compile the source for any platform.

C ++ supports writing OOP-style programs, which C does not know how. In this case, the application becomes only a set of classes, objects that are able to interact with other elements of the code. This helps in developing large applications.

How did C ++ evolve in stages?

C ++ development steps:

  • 1979-1980 - C ++ appeared and was positioned as a C language with additional classes,
  • 1983 - the language began to be called, as we all used to C ++,
  • 1985 - release of the commercial version of C ++. In the same year the first paper book “ C ++ programming language ", It included a description of the features, capabilities and rules of using the language,
  • 1989 - the second version of the language with advanced features is released,
  • From 1990 to 2011 - slow development and addition of functionality. It is also worth mentioning that in 1998 for the first time they tried to standardize the language. That standard was subsequently called ISO / IEC 14882: 1998, today C ++ 98. In 2003, the following version of the C ++ 03 standard appeared,
  • 2011 - publication of the C ++ 11 standard, it really has a lot of innovations. The update has enriched the language with an abundance of useful features,
  • 2014 - release of a relatively small addition to the previous version of the standard. He was nicknamed C ++ 14,
  • 2017 is the last major release of the language.

How to start programming in C ++

Stock up on a cup of delicious coffee, sit in front of the computer and run the IDE. However, if you first started, then you need to read how to use your IDE, the network has a lot of information on this topic. To start, just find out: how to create a program file, how to compile a written program, and how to run it. This is a matter of 10-15 minutes.

Well, traditionally, the code of the first program that you can paste into the editor, compile and run:

Programming environments, compilers

To write a program in C ++, a compiler is required, which converts the original code into suitable for execution in the file. There are innumerable compilers today. They differ in the mass of parameters, including the method of implementation of the standards. At the stage of choosing a compiler, it is better to choose those that are constantly maintained and updated.

To work with C ++, you must install a development environment. You can install any environment convenient for you or use the online compiler altogether. Among the most popular development environments can be noted such as: Visual C ++, Xcode (Mac only), GCC, Intel C ++ Compiler, Embarcadero (Borland) C ++ Builder.

First C ++ Program - Lesson 1

As a development environment for Windows, the author advises using Visual Studio 2008 (800 MB) if you have Windows XP, Visual Studio 2013 (6.5 GB) for Windows 7 and above, or Dev C ++ 5 (41 MB) for those who have too much Slow internet to download Visual Studio. For users of Unix-like systems, you need a GCC compiler and any text editor such as Vim.

After you have installed everything you need, let's start writing the first program.

C ++ Branching Design - Lesson 3

There are situations when a program needs to choose which operation it should perform, depending on a specific condition.

For example, we enter an integer from the keyboard. If this number is more than ten, then the program must perform one action, otherwise - another. We implement this algorithm in C ++ using branch designs.

Arrays in C ++ - Lesson 5

Today we’ll talk about arrays. You already know that a variable is a cell in the computer’s memory where one single value can be stored. Array Is a memory area where several values ​​can be stored sequentially.

Take a group of ten students. Each of them has a surname. Creating a separate variable for each student is not rational. Let's create an array in which the names of all students will be stored.

Pointers in C ++ - Lesson 7

When executing any program, all the data necessary for its operation should be loaded into the computer’s RAM. To access variables in memory, special addresses are used, which are written in hexadecimal form, for example, 0x100 or 0x200.

If there are too many variables in memory that cannot be accommodated by the hardware itself, the system will overload or freeze.

Classes in C ++ - Lesson 10

The whole real world is made up of objects. Cities consist of districts, each district has its own street names, on each street there are residential buildings, which also consist of objects.

Almost any material object can be represented as a set of objects of which it consists. Suppose we need to write a program to track student performance. You can imagine a group of students as a C ++ language class. Let's call it Students.

Pin
Send
Share
Send
Send