Basic Structure Of CPP

The Format of writing a Program in c++ is called its Structure. The Basic structure of C++ is very flexible. It increases the power of language. Structure of c++ consists of following parts. · Preprocessor Directive · Main() function · Program body (c++ statement)

The Format of writing a Program in c++ is called its Structure. The Basic structure of C++ is very flexible. It increases the power of language. Structure of c++ consists of following parts.
BAsic structure of cpp
BAsic structure of cpp

·         Preprocessor Directive
·         Main() function
·         Program body (c++ statement)

Preprocessor Directive

Preprocessor Directive is an instruction given to the compiler before the execution of actual program. Preprocessor directives are also known as Compiler Directive. The preprocessor directive is processed by a program known as preprocessor. It is part of c++ compiler.IT modifies C++ source program before Compilation. The semicolon is not used at the end of preprocessor directives.
Include Preprocessor
Include preprocessor directive is used to include header files in the program. The syntax of using this directive is as follows:
#include<iostream.h>
The above statement tells the compiler to include the file iostream.h in source program before compiling it.
Header file
Header Files are the collection of a standard library function to perform different tasks. There are many header files for different purpose. Each files contain different types of predefined functions. Many header files can be included in one program. The header file must be included in the program before calling any of its function in the program.
The extinction of a header file is .h. The include preprocessor directive is used to include header files in programs. These files are provided by c++ compiler system.
The header file are normally stored in INCLUDE subdirectory. The name of header file is written in angle brackets.
Syntax
 The syntax of using header file is as follows:
#include<header_file_name>
The header file name also be include in Double quotes as follows”
#include”header file name”
Example
#include<iostream>
Iostream stand for input output steam. This header file contains the definitions of built in input and output function and object.
A header file math.h is used in program to use predefined mathematical functions. The following statement is used to include this file in program.
#include”math.h”

Main ( ) Function

The main function is the starting point of c++ program. When the program is run the control enters main() function and starts executing its statements.
Each program must contain main () function. If a program does not contain main functions, it can be compiled but can not be executed. Any number of statement can be written in the body of main () function. The syntax of main function is as follows.
Void main ()
{
Body of main function
}

C++ statement/ Program Body

The statement of the program written in curly braces. The curly brace { is called opening brace and }is closing brace. The braces are also known as delimiters. These statements are collectively known as the body of a program. Each statement in C++ language is terminated by semicolon.
A statement in C++ language is an instruction for the computer to perform a task. Computer perfroms these instructions one by one in the same sequence in which these instruction are written.
Example:
The following example explains the basic structure of C++ program.
:Preprocessor Dirrective                            #inlcude<Iostream.h>

Main function   :                                                void main()
                                                           
                                           {
[Programe body]                     Cout <<”welcome to rbatec”;
                                                    }
·         The first line in the preprocessor directive to include a header file Iostream.h.
·         The second line is main function where the execution of program starts.
Using ‘Cout’
The cout object is used to print a message on the screen. The message may consist of strings and value. A string is a set of characters. The cout object is used with the insetion operator <<. Anything written after insertion operator in displayed on the screen.


cpp structure
cout body

COMMENTS

Name

andriod.computer trix,1,Blogging,1,CppTutorial,8,create viruse,1,cyber security,1,fb trix,1,gmailtrix,1,laptop screen shot,1,Mobilink,1,notepad tricks,1,notepad viruse,1,PCSREEN SHOT,1,Search engine optimization (SEO),1,seo,1,software,1,Technology,5,tips,1,visitor.seo traffic,1,
ltr
item
Computer Tech Articles: Basic Structure Of CPP
Basic Structure Of CPP
The Format of writing a Program in c++ is called its Structure. The Basic structure of C++ is very flexible. It increases the power of language. Structure of c++ consists of following parts. · Preprocessor Directive · Main() function · Program body (c++ statement)
https://2.bp.blogspot.com/-yjbcHF3jRxY/WJGWRVDKceI/AAAAAAAAA4M/P1K50kP_w-oll6l-utHpArR_xOG-88A_ACLcB/s400/cpp%2Bbasic.PNG
https://2.bp.blogspot.com/-yjbcHF3jRxY/WJGWRVDKceI/AAAAAAAAA4M/P1K50kP_w-oll6l-utHpArR_xOG-88A_ACLcB/s72-c/cpp%2Bbasic.PNG
Computer Tech Articles
https://rbatec.blogspot.com/2017/02/Basic-structure-of-Cpp.html
https://rbatec.blogspot.com/
https://rbatec.blogspot.com/
https://rbatec.blogspot.com/2017/02/Basic-structure-of-Cpp.html
true
8514118360251607171
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy