The fastest language is Assembly, there is no question about that. Assembly is basically the "machine code", that is what the computer understands, but it has poor legibility and isn't really maintainable compared to higher-level languages. So, there are just a few weirdos who like to code in that language (I am talking about you, Eduard). This language is still used in microcontrollers (AVR, PICs) in applications such as filters or control theory, where the processing speed matters, something like 10 µS reaction time or less.
Then, we can talk about C, which was made using Assembly. C is a powerful general-purpose programming language. It is like the father of all the current languages we have today. It can be used to develop software like operating systems, databases, compilers, and so on. It also provides powerful and clear control of all the data types it manages.
C++ can be seen as the successor of C. Its creation intended to extend the C programming language mechanisms to allow the manipulation of objects. C++ is a general-purpose language based on C, which incorporates new data types, classes, templates, exception mechanism, namespace system, inline functions, operator overloading, references, operators for memory management, and some additional library utilities.
The run time of C++ versus C would suffer only if you use certain C++ specific features. On the other hand, inlining and templates in C++ may allow you to do a lot of work compile-time that C defers to run time. In some cases, C++ may end up faster than C.
Except for C and Assembly, comparing C++ with other languages, C++ will beat them in time, as it gives you full control of the computer resources/data. In C++ you can implement anything that currently exists in the computer science world. As it is the best language in the ratio of speed vs scalability, it is not a surprise that companies such as Google, Nasa, Spacex and more keeps using it.
Here is a small comparison of Python vs Pypy vs C++ times in a problem from Facebook Hacker Cup 2020. You can download the programs I did.
C++ needs a lot of code, which means you need a large team to scale a C++ app, and from a time and financial investment point of view, C++ not easy to scale. C++ is rather lower level, the language is huge and you will need to handle a lot of complex things such as memory management and more. Since you have to do a lot of things manually with C++, it's easy for less experienced or less skilled developers to introduce errors into the code base, which makes also really hard to find the bugs or typos inside of the code. Additionally, in terms of talent-recruiting or team-matching, a very skilled and experienced C++ developer/programmer may be hard to find and also expensive to afford.
I think that rather than perfect your skills in Assembly/C/C++, there are other topics/areas that will be more worth it to learn and expand your CV, such as Artificial Intelligence, Deep Learning, Natural Language Processing, Data Mining, Data Science, Statistics, Artificial Vision and more. But I still think that C++, C and Assembly will teach you what the computer does with your code, and how it handles the data. That is why I do recommend learning them, but not really into such a deep level, after all, anything you can do in C++, you can do it as well in Java or Python (but slower).
But of course, if your goal is to be one of the best in competitive programming, C++ is your horse.
You need to install MinGW, so go to the official webpage and download the suitable version for you. Then run the installator and continue the following steps.
You can leave the default settings and continue.
Mark the packages you want to install, if you want to run your Cpp files you can leave just the basic setup.
After you select the packages you want to install, apply the changes and the installation from internet will start.
Aceppt the installation of the packages.
The basic setup
To confirm that you installed MinGW properly, go to the main path of your computer and check that it is there.
To set the environment variables, go to:
Control Panel > System and Security > System > Advanced system Settings > Environment Variables
Then, you will need to edit the variable "Path" in the 2 sections. Then, you will need to add the paths "C:\MinGW\bin",
in case you followed the default installation, otherwise search for your MinGW path, and add them to the "Path" variable.
To verify that you installed MinGW and set the environment variable properly, go to the terminal and type "g++ --version".
Using the following code as example:
#include
using namespace std;
int main(){
for(int i=0; i<5; i++){
cout << "Hello World! " << i << endl;
}
return 0;
}
Go the path where your files are, then build the ".exe" file, and at the end, just run the ".exe" file.
$ cd [folder_path]
$ g++ -o .\[out_file_name].exe .\[cpp_file_name].cpp
$ .\[out_file_name].exe
You can run and debug C++ files in VSC, but you will need to install some extensions to have a better experience.
Extension | Description |
---|---|
C/C++ | The C/C++ extension adds language support for C/C++ to Visual Studio Code, including features such as IntelliSense and debugging. |
C++ Intellisense | Provide Intellisense for C/C++ with the help of the GNU Global tool in Visual Studio Code. |
C/C++ Compile Run | Compile & Run C/C++ opened file directly from the command pallet or by pressing "f6" or "f7" |
With the extensions installed, you will only need to press "f7" in the editor area, and then a small menu will pop up, where you only need to press enter and continue to the next menu.
If you have any argument to specify in the code, you have to write it down, otherwise, leave it blank and press enter.
Then in the terminal will appear the result of running your program.