Arnab Chakraborty has Published 4458 Articles

C++ program to concatenate a string given number of times?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

386 Views

Here we will see how we can concatenate a string n number of times. The value of n is given by the user. This problem is very simple. In C++ we can use + operator for concatenation. Please go through the code to get the idea.AlgorithmconcatStrNTimes(str, n)begin    res := ... Read More

C++ Program to count Vowels in a string using Pointer?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

441 Views

To get the vowels from a string, we have to iterate through each character of the string. Here we have to use pointers to move through the string. For this we need C style strings. If the string is pointed by str, then *str will hold the first character at ... Read More

C++ Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! + …… n/n!

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

1K+ Views

Here we will see how we can get the sum of the given series. The value of n will be given by user. We can solve this problem by making a factorial function, and get factorial in each step in the loop. But factorial calculation is costlier task than normal ... Read More

C++ tricks for competitive programming (for C++ 11)?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

214 Views

Here we will see some good tricks of C++ programming language that can help us in different area. Like if we want to participate in some competitive programming events, then these tricks will help us to reduce the time for writing codes. Let us see some of these examples one ... Read More

c16rtomb() function in C/C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

100 Views

In C++, we can use 16-bit character representations. The c16rtomb() function is used to convert 16-bit character representation to narrow multi-byte character representation. We can find this function inside the uchar.h header file.This function takes three parameters. These are −The string where multi-byte character will be stored16-bit character to convertThe ... Read More

c32rtomb() function in C/C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

73 Views

In C++, we can use 32-bit character representations. The c32rtomb() function is used to convert 32-bit character representation to narrow multi-byte character representation. We can find this function inside the uchar.h header file.This function takes three parameters. These are −The string where multi-byte character will be stored32-bit character to convertThe ... Read More

C/C++ Program for Maximum height when coins are arranged in a triangle?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

469 Views

In this section, we will see one interesting problem. There are N coins. we have to find what is the max height we can make if we arrange the coins as pyramid. In this fashion, the first row will hold 1 coin, second will hold 2 coins and so on.In ... Read More

C/C++ Program for Triangular Matchstick Number?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

81 Views

Here we will see how to count number of matchsticks are required to make the pyramid-like below. The base of the pyramid is given. So if the base is 1, it will take 3 matchsticks to make a pyramid, for base 2, 9 matchsticks are needed, for base size 3, ... Read More

C/C++ Program to Count Inversions in an array using Merge Sort?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

598 Views

The inversions of an array indicate; how many changes are required to convert the array into its sorted form. When an array is already sorted, it needs 0 inversions, and in other case, the number of inversions will be maximum, if the array is reversed.To solve this problem, we will ... Read More

C/C++ Program to Count set bits in an integer?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

847 Views

Here we will see how we can check number of set bits in an integer number. The set bits are 1’s in the binary representation of a number. For an example the number 13 has three set bits 1101. So the count will be 3.To solve this problem, we will ... Read More

Advertisements