# My First C++ Program

C++ Program is a Basic programing language.

**The first program is**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719742146026/11b9d216-eadb-4080-935f-6ba55f822a05.png?auto=compress,format&format=webp align="left")

### C++ Syntax

**int** : Int is integer(whole numbers) is using in numbers. **without decimals**,

Example:12,-23.......

**\*\*float:\*\***n C++, the "float" data type is **used to store floating-point numbers, which are decimal numbers that can have fractional parts**. Floats occupy 4 bytes of memory and have a range and precision that is typically smaller than that of the "double" data type.

**cout**: cout in C++ is **used to display output to the screen**. The 'c' in cout stands for character, and 'out' stands for output. Thus cout refers to character output. We use the insertion operator along with cout to output formatted data. cout in C++ is defined in the iostream header file. What we want to get as output is what is included in the output

**COPY**

```plaintext
cout<<"Enter Number ";
```

**\*\*cin\*\*:**The cin object in C++ is **an object of class iostream**. It is used to accept the input from the standard input device i.e. keyboard. It is associated with the standard C input stream stdin. The extraction operator(&gt;&gt;) is used along with the object cin for reading inputs. .A scene is an opportunity to provide user input

**endl**: In C++, endl is **an output manipulator used with the insertion operator (&lt;&lt;)**. It's part of the standard library and performs two main functions: it inserts a new line, and it flushes the output [**buffer. An**](http://buffer.an/) endl is an instruction to enter another line after the end of one line

**return** : **Terminates the execution of a function and returns control to the calling function** (or to the operating system if you transfer control from the main function). Execution resumes in the calling function at the point immediately following the call. Return intends that a program has ended

```plaintext
#include <iostream>
using namespace std;

int main(){

return 0;
}
{ } , << , >> , ; , " " , ( )
```

This are C++ structure

### Examples

**1)Calculate the Difference of Two Numbers**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719764504760/cdc7bea6-42de-4a67-a526-43f8043c6b67.png?auto=compress,format&format=webp align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719800768062/98620b09-e716-48a4-bbd1-2409f88bb56f.png?auto=compress,format&format=webp align="left")

Find Difference between two numbers. Accept Numbers from user and find difference between two numbers.

**2) Calculate The Product of Two Numbers**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719765118777/65339bbd-502c-4540-8950-e9e787f020fa.png?auto=compress,format&format=webp align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719801095805/abeb1942-d093-4624-80bc-5fe94b051c26.png?auto=compress,format&format=webp align="left")

Find Product Two Numbers.Declare Variables ,Accept Numbers from user and find Product of Two Numbers.

**3)Calculate Area of Cricle**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719765491832/c8022600-996a-4a62-a75e-57e1e39e8994.png?auto=compress,format&format=webp align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719800817585/0b969fbb-4649-4a3a-b8c4-7800f492f7ba.png?auto=compress,format&format=webp align="left")

Define PI Value, Declare Variables, Accept Radius from user and Find Area of Circle.

**4)Swap Two Numbers**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719765796542/b62e85f0-1e76-4251-9107-4260c2f73bd6.png?auto=compress,format&format=webp align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719800958107/64173712-f618-4300-83d4-cb50712dce93.png?auto=compress,format&format=webp align="left")

Swap Two Numbers, Declare Variables, Accept Two Numbers From User and Swap Numbers Use temp Variable.

### Console

Console in C++ is **the window at which the output of your program appears**. Any data sent to the standard output is displayed on the console. If the console isn't cleared while the program is executing, the next time the program is called it would output in a prefilled console screen.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719768812993/13e378d5-3f91-4474-b2b8-d554da61a86e.png?auto=compress,format&format=webp align="left")
