# cplusplus-program

## C++ program to swap two numbers

Swapping refers to the exchanging of values stored in different variables. For example, if there are two variables named a and b, and the value inside a is 4 and inside b is 5. Then swapping these two variables would result in – a = 5 and b = 4. …

## C++ program to check prime number

In this program we will check whether a number entered by the user is prime or not. A prime number is a number which can be divided only by 1 and itself. For example 5, 7, 13 and so on. To understand this program, you must know the following topics …

## C++ program to make a simple calculator

In this program we will learn how to make a simple calculator in c++. The calculator would do four simple operations- addition, subtraction, multiplication and division. To understand this program, you should have knowledge of the following topics in c++ : Variables Data types Switch statement Arithmetic and assignment operators …

## C++ program to check even or odd number

In this program we will check whether a number entered by a user is even or odd by writing some code. To understand this example you should have the knowledge of – Variables Conditional statements Arithmetic operators(including modulus operator) Main function #include<iostream> using namespace std; int main() { int num; …

## C++ program to print value stored in a variable

In this program we will learn how to print the value stored in a variable in C++. Example 1 – Initializing variable manually #include<iostream> using namespace std; int main() { int x = 7; cout<<x; return 0; } Output 7 Explanation:- The first line is written to include the standard …

## Hello World Example in C++

In this C++ program we will print a message “Hello World”. #include<iostream> using namespace std; int main() { //This will print the message Hello World cout<<"Hello World"; return 0; } Output Hello World Explanation The first line in the program is written to include the iostream header file in our …