Skip to content

Category Archives: C++ Programs

Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function that prints all occurrences of pat[] in txt[]. You may assume that n >… Read More
We are given an array of elements and we have to check the whether each element is even or not.  Examples: Input : [2, 4,… Read More
Given a password entered by the user, check its strength and suggest some password if it is not strong. Criteria for strong password is as… Read More
We are given an integer n and n-th term in a series as expressed below:   Tn = n2 - (n-1)2 We need to find Sn… Read More
Festival of Holi is around the corner and to all the coding geeks around there, let it be more than just a holiday and learn… Read More
In our previous post on fibonacci series, we have seen many approaches to generate fibonacci numbers. In this approach, we shall be generating fibonacci numbers… Read More
Given a file and a line number n, the task is to delete nth line from the given text file. Suppose the initial content of… Read More
Given a number, check if it is a perfect square or not.  Examples :  Input : 2500 Output : Yes Explanation: 2500 is a perfect… Read More
This valentine, gift your loved ones a heart with a message written within it to express what you feel about them. Don’t miss the moment… Read More
In hashing there is a hash function that maps keys to some values. But these hashing functions may lead to a collision that is two… Read More
Given the number of rows and columns, print the corresponding swastika pattern using loops.  Note: The number of rows and columns should be the same… Read More
Given an IP Address and task is to change the IP address equivalent the hexadecimal value. Examples: Input : 127.0.0.1 Output : 0x7f000001 Input :… Read More
Given source and destination text files. Append the content from the source file to the destination file and then display the content of the destination… Read More
Given a text file, extract words from it. In other words, read the content of file word by word. Example : Input: And in that… Read More
Given GPS co-ordinates(in degrees) of a person who needs a cab and co-ordinates of all the cabs in the city stored in a text file… Read More

Start Your Coding Journey Now!