C++ Language

Count Set bits in an Integer

In this blog post, I will teach you how to write C/C++ Program to count set bits in an Integer. After reading this post you able to write an efficient program to count the number of 1s in the binary representation of an integer. Examples, Input : n = 9 Output : 2 Binary representation […]

Count Set bits in an Integer Read More »

Range-based for loop in C++

In this blog post, I will explain the range-based for loop with the help of example code. The range-based for loop is introduced in C++11. It executes a for loop over a range and is more readable equivalent to the traditional for loop.  See the below syntax for the range-based for loop. Syntax: for (

Range-based for loop in C++ Read More »