DAY 1 OF LEARNING C++
Published: 2022-01-16 20:05:42

## INTRODUCTION TO C++

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/05qp9rt66qry9543q92m.png)
 

- A Program is a Set of Instructions that tells computer what to 
  do in order to come up with a solution to a particular program. 
  Programs are written using a programming language. There are two 
  major types of programming languages: low-level languages and
  high-level languages.

## Low-Level Languages

- A low-level language is a programming language that provides 
  little or no abstraction of programming concepts and is very 
  close to writing actual machine instructions.

 Eg : Machine Language , Assembly Language.

- **Machine language**, or machine code, is the only language that is  
  understood by the computer, and it does not need to be 
  translated. It is in binary numbers (1s' and 0s'). 
  A program instruction in machine language may look something 
  like this:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5x5b4r8nbxgfj0x85b44.png)
  
-**Assembly Language**  is the first step to improve programming 
 structure and make machine language more readable by humans. An 
 assembly language consists of a set of symbols and letters.
  
 **A translator is required to translate the assembly language to 
 machine language called the 'assembler.'**

## High-Level Languages

- It allow programmer's to write instructions in a language that 
  is easier to understand.

- **Compiler**    : It converts HLL(High Level Language) to 
  machine language in one run.

- **Interpreter** : It converts HLL(High Level Language) to 
  machine language Line by Line.

- **Source Code** : Program written in High Level Language.

- **Object Code** : Program in Machine Language. 


## Algorithm
- Algorithm is Step by Step procedure to write a Program.

## Flowchart
- Graphical representation of algorithm is known as Flowchart.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y7d78j4kfva6rvkmd9it.png)
 
## Pseudocode

- Pseudocode is a method of describing computer algorithm using a 
  combination of natural language and programming.

**Example 1**
 Write a flowchart and pseudocode for finding the sum of 2 
 numbers.

 PSEUDOCODE

```
1. Start
2. Input 2 numbers ʹ number1 and number2
3. Add number1 and number2 to find sum
4. Print sum
5. End

```
 FLOWCHART

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t16s7jmjkq1osa7lo1jw.png)

**Example 2**
 Write a flowchart and pseudocode to find maximum of three given 
 numbers.

 PSEUDOCODE

```
1. Start
2. Read three numbers ʹ a,b and c
3. Compare a and b, if a > b
      Compare a and c, if a > c
                 Print a
      Else
                 Print c
    Else
      Compare b and c, if b > c
                 Print b
      Else
                 Print c
4. End

```
 FLOWCHART

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0hxld3d1sklf143nfzb.png)

**Example 3**
 Write a flowchart and pseudocode to find a number is prime or not.

 PSEUDOCODE

```
1. Start
2. Read a number n
3. Initialise divisor = 2
4. Repeat till divisor < n
     If n is divisible by divisor
         Print ͞Non-Prime͟
         End
     Else
         divisor = divisor + 1
5. Print ͞Prime͟
6. End

```
 FLOWCHART


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8czk3pz13xhbl3fpjemu.jpg)

**Example 3**
 Write a flowchart and pseudocode to find a number is prime or not.

 PSEUDOCODE

```
1. Start
2. Read a number n
3. Initialise divisor = 2
4. Repeat till divisor < n
     If n is divisible by divisor
         Print ͞Non-Prime͟
         End
     Else
         divisor = divisor + 1
5. Print ͞Prime͟
6. End

```
 FLOWCHART


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8czk3pz13xhbl3fpjemu.jpg)

**Example 4**
 Write a flowchart and pseudocode to find sum of n natural 
 numbers.

 PSEUDOCODE

```
1. Start
2. Read a number n
3. Repeat the following till n becomes equal to 0
                        Add n in sum
                        Decrement n
4. Print sum
5. End

```
 FLOWCHART


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hxsnqjrnjf7llpjwwbse.png)





                
 ***************  THANK YOU ALL FOR READIND **********************

 @pranvmadhavan1

 INSTAGRAM :  [@_pra.n.v](https://www.instagram.com/_pra.n.v/)