SYNTAX OF C++

 SYNTAX OF C ++ 

C++ is a object oriented programming language that works on framework and structure which provide it stability and easier to use. every language has its own syntax, and each works based on its syntax. syntax basically means some the guidelines regarding passing(writing)statements in a programming language. 

As I said before every programming language has its own syntax C++ also has its syntax based on its functions and workings.  


SYNTAX OF C++





Let's deep dive. 

1.#INCLUDE<IOSTREAM.H> 

Firstly, #include is a preprocessing directive trough which we can import the header file from library. 

The following statement i.e. #include tells the compiler to include the header file which is <iostream> from the library which initially stores the methods of Cin and Cout which we use for taking input and processing it towards output. 

where iostream means standard input output stream which is a oops library which provides input output functionality using streams 

syntax: #include<name_of_library>

2.#INCLUDE<CONIO.H>

Conio.is also a oops library which has many built in functions they generally help in performing basic input and output in program but hold various functions some of them are Clrscr (), Getch () and many more these functions only works when this file is called in program.  

3.MAIN FUNCTION.

Main function is the most important part of C++ programming because the execution of program start when the main function is called, it is user defined function that is important for execution of program.

Main function is the foundation of C++ programming because all the instructions and statements are declared within the function, main function can either return integer or void means null.

4. BLOCKS or {}.

Blocks are the statement which are enclosed within {}. They help us to see the scope of identifiers and statements which are declared within the program.


5.SEMICOLONS (;).

You may have observed that we have used semicolons just after every statement, we use semicolons just to terminate the line and let the compiler understand to move to next line. when we apply a semicolon the compiler observes it and it terminates the statement of that line and move to next line. 


6. OUTPUT THROUGH COUT<<.

We have here used a very basic program of C++ through which the output we want is "Namaste from Bharat" but that's what we think but to let the compiler understand the program we need a proper method through which the compiler understands, Cout<< let the compiler understand that what has to be the output. 

7.GETCH.

Getch is a function in C++ which is present in a library named conio which pauses the output screen up till a key is pressed. The full form of Getch get character so what it does is by pressing any key it shows output on screen.
 



 

THE OUTPUT SCREEN: 



 

8. HOW TO COMPILE AND RUN THE PROGRAM.

COMPILE:

When you open turbo C++ you will be seeing a task bar at the top and there you can see the option named compile click on it and select the program will be compiled, to compile is to read all the statement and list out the errors which has been made during the program. You can also use a shortcut key which is alt-f9. 

RUN:

When you open turbo C++ you will be seeing a task bar at the top and there you can see the option named run click on it and you will directly reach to output screen, You can also use a shortcut key which is ctr-f9. 

So, through this you will be having a basic idea of the syntax of c++ and how it works we will study more about it up till keep stick to our page.


Comments