Frequency Counter in c++

Suppose you write a code that generate a set of 50 random numbers in the range 1 to 100. Now you would like to count the frequency of the number that your code has generated. Well there are lots of other ways. But today I will discuss about how you can use c++11 to do the trick. Continue reading

Posted in C/C++, programming | Tagged , , | Leave a comment

Print a Diamond shape using array

Previously I have posted a similar post on how to print diamond shape using asterisks in c/c++
Some of you have asked me if there is any other way to solve this diamond shape asterisks problem. Of course Continue reading

Posted in C/C++, programming | Tagged , | 3 Comments

How to use infinte loop in c++ programming …

Today I am not gonna solve any text book based programme. Let’s have some Fun.
We are going to write a programme which continuously open & close CD / DVD tray.

We’ll use it to make a ‘AUTOMATED MECHANICAL ROCKER’ for the babies ๐Ÿ˜› . Before we proceed, let’s take a look at the video. You’ll get a hint that what we are going to do with this programme ๐Ÿ˜€ Continue reading

Posted in C/C++, fun, programming | Tagged , , , | 2 Comments

Using C++ to calculate factorial or double factorial of a number

Today I would like to discuss about “How to calculate the factorial of an integer number”. In mathematics factorial of a non-negative number is denoted by n ! . Where n ! = n  \times  (n-1)  \times  (n-2) ....... \times  2  \times  1 Example : 5 ! = 5  \times  4  \times  3  \times  2  \times  1 = 120. In C++ we can calculate it Continue reading

Posted in C/C++, programming | Tagged , , | 3 Comments

Print a diamond shape using asterisks in C/C++

Update: I wrote this post back in 2009. I don’t maintain this blog anymore. Since there are lots of people still visiting this post and asking questions, I thought it would be a good idea to rewrite it. So I moved this post here. I have also added some brief explanation and some new shape using asterisks.

Please visit here for updated post. ๐Ÿ™‚

It is a very common question for both C and C++ programmers that printing a diamond shape using asterisks (*) and this question is asked in almost every freaking semester ๐Ÿ˜‰ .There are a lot of different ways to do that. But among them I found this one easier. Continue reading

Posted in C/C++, programming | Tagged , , | 162 Comments

Solve a function using C++

Let us consider a very simple function f(p,q)=p+q . And your assignment is to solve it using c++. How can you do it? Just take a look-
Continue reading

Posted in C/C++, function, programming | Tagged , , | 3 Comments

Calculating sum of a series of numbers using C

If you want to calculate the sum of a series of numbers. Let’s starts with a very simple series i.e. s=  1+2+3+........+n . Here is how you can do it. Continue reading

Posted in C/C++, programming, series | Tagged , , , | Leave a comment

A very simple C++ program “HELLO WORLD”

Today I am going to discuss about one of the most popular and most simple C++ program. This is also my first program in C . This code is soo simple and only gives you one output “Hello World” .Let’s starts programming, shall we? :D- Continue reading

Posted in C/C++, programming | Tagged , | 2 Comments

Introduction to C/C++ Programming


A C/C++ program is a collection of commands, which tell the computer to do “something”. This collection of commands is usually called C++ source code.

C/C++ seems to be a strange name for a programming language . But this strange sounding language is one of the most popular language today.

C was invented by Dennis Ritchie in 1972 and it was developedย  Continue reading

Posted in programming | Tagged , | 1 Comment