C++ Programs

Programs in C and C++ languages to develop programming skills and prepare for exams and interviews.

Last Reviewed and Updated on February 7, 2020

This is my own collection of programs in C and C++ programming languages. I have provided solutions to all of them. Write to me if you have a more optimal solution, or you find any mistakes in the solutions. I have myself tested all these programs on Microsoft Visual C++ compiler.

My C/C++ Videos on Youtube

Here is the complete playlist for video lectures and tutorials for the absolute beginners. The language has been kept simple so that anybody can easily understand them. I have avoided complex jargon in these videos.

Recently Added and Reviewed

We are constantly adding new content and reviewing older posts so that we can provide live information, updated with new facts and interesting things related to them. These are the most recently added and reviewed posts. Click on them to go through them.

Convert char from lowercase to uppercase

This program is about converting a lowercase English character to its corresponding uppercase character. It is a simple hack but the C built-in function toupper is definitely faster than this one.

C Program to classify character input

This program asks the user to enter a single character of text. Then it examines the ASCII code to determine whether it is a lowercase, uppercase or a digit. It also shows how a loop can be implemented with statement labels.

Simple C Program to exhibit fuzzy behavior

Don't expect a lot from this program. It simply returns the results of a calculation by using a different formula each time. The end-user doesn't know the internal mechanism, so, to him it appears like a random behavior.

C Program classroom exercise on decisions and loop

This program is here mainly because it demonstrates how a switch statement with its fall through can be easily used to implement a seemingly complicated algorithm.

C Program to demonstrate looping without loops

This program demonstrates how to write a loop without any of the loop constructs. Of course, many programmers would call it a bad programming practice. Nevertheless, it is a nice program that can help us develop skills by writing a program differently.

C Program to write a number guessing game

Here is a program that can guess the number in the mind of a user, of course by asking questions that have either a yes or no as the answer. This program has been written in simple steps that are easy to understand. A well written program is the one which does its job in the least number of steps. Write to me if you have a shorter version.

Program to display a pesudo random message

This program is about one of the most common uses of the modulus operator. This operator can be used to cycle through various case labels of a switch. For example, modulus of any number with 5 will give one of these five digits only 0, 1, 2, 3 or 4,

C/C++ Practice Problem - 1

This is my series on C/C++ problems for accepting user input in a robust way. The questions of this series start from C programs, and they slowly build and convert to classes, and which further build into inheritance. This is Problem 1 of this series.

C/C++ Practice Problem - 2

This is my series on C/C++ problems for accepting user input in a robust way. The questions of this series start from C programs, and they slowly build and convert to classes, and which further build into inheritance. This is Problem 2 of this series.

C/C++ Practice Problem - 3

This is my series on C/C++ problems for accepting user input in a robust way. The questions of this series start from C programs, and they slowly build and convert to classes, and which further build into inheritance. This is Problem 3 of this series.

C/C++ Practice Problem - 4

This is my series on C/C++ problems for accepting user input in a robust way. The questions of this series start from C programs, and they slowly build and convert to classes, and which further build into inheritance. This is Problem 4 of this series.