C++C++11C++14C++17Language FeatureLearn C++

Quickly Learn To Count Prime Numbers In GNU C++ On Windows

GNU C/C++ Compiler (gcc , g++)

GNU GCC is another powerful C/C++ compiler originally written as the compiler for the Unix, Linux and GNU operating system. The GNU system was developed to be 100% free software, and it is efficient with both 32-bit and 64-bit operations. This compiler can be used on Windows using MinGW or CygWin Linux Simulators. Compiled executable files need a small dll to run independently on Windows. It is mostly compatible with CLANG standards. GCC Compiler can be used by Visual Studio Code, Dev C++, Code Blocks, and can be directly used with Command Prompt or PowerShell. It is available on the official product page https://gcc.gnu.org/.

This is a C++ Builder example to find number of prime numbers in a given range. In this example we are measuring calculation time of count_primes() function in five times.

We compiled and run this code on Windows by using MinGW linux simulator. Here are the results on run time.


Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

Related posts
C++C++11C++14C++17Introduction to C++Learn C++

Learn about C++ Encapsulation

C++C++11C++14C++17Introduction to C++Learn C++

Discover Class Methods in C++

C++Learn C++Videos

Learn C++ With Monoids, Monads, and Applicative Functors: Repeated Software Patterns (CPPCon 2020) Video

C++Learn C++Videos

Learn C++ With Pipes: How Plumbing Can Make Your C++ More Expressive by Jonathan Boccara (CPPCon 2020) Video

Worth reading...
C++ Is 9.4 Times Faster Than Python In Prime Number Test