Month: November 2017

[C++] An Interesting Bit Array Example

Here is an interesting bit array task and its solution in C++ that I thought it’s worth to share with you.
You are given four integers values: N, A, B, and C. You need to use them in order to create the sequence called bitArray with the following pseudo-code:

Task: calculate the number of distinct integer in the bitArray sequence.

Solution
Input: four space separated integers on a single line, N, A, B, and C  respectively.
Where N = 32, A = 16, B = 16, C = 16.
Output: 
one integer that denotes the number of distinct integer in the bitArray sequence equals 7 as we set N, A, B, C values.

If you’d like to read the input from the console simply comment out line 57 and 62 and toggle comment selection on line 58, 59, 60 and 61.
Input read from the console:

four space separated integers on a single line, N, A, B, and C  respectively.
Output print to the console: 
One integer that denotes the number of distinct integer in the sequence called bitArray.

The number of distinct integer  in the sequence  will be 536870912 when we change the previously set integer values to:

Use Wandbox online C++ compiler

[C++] cxx_status and support in Clang

Here is the list of current C++ implementation status and support in Clang as per Aug 2017.
You can find the complete list of features and minimum Clang version with support on the source page: https://clang.llvm.org/cxx_status.html

C++11 implementation status
Clang 3.3 and later implement all of the ISO C++ 2011 standard. By default, Clang builds C++ code according to the C++98 standard, with many C++11 features accepted as extensions. You can use Clang in C++11 mode with the -std=c++11 option. Clang’s C++11 mode can be used with libc++ or with gcc’s libstdc++.

C++14 implementation status
Clang 3.4 and later implement all of the ISO C++ 2014 standard.

You can use Clang in C++14 mode with the -std=c++14 option (use -std=c++1y in Clang 3.4 and earlier).

C++17 implementation status
Clang 5 and later implement all the features of the C++ 2017 Draft International Standard.
You can use Clang in C++17 mode with the -std=c++17 option (use -std=c++1z in Clang 4 and earlier).

C++2a implementation status
Clang has experimental support for some proposed features of the C++ standard following C++17, provisionally named C++2a. Note that support for these features may change or be removed without notice, as the draft C++2a standard evolves.
You can use Clang in C++2a mode with the -std=c++2a option.

More technical specifications and standing documents on the source page: https://clang.llvm.org/cxx_status.html

[Linux]Install WordPress on Ubuntu server