INTRODUCTION OF C++
C++ is a Programming Language
before discuss C++, let's first discuss programming
Programming is the process of build a set of
instructions, that tell to computer how to perform a
task. As we know that computer does not know our
language, it knows binary or machine language (0,1)
is known as Low Level Languages.
and We don't know Low Level Language, we know
High level language like C++ (because its similar to
our English language). For this we convert Low level
language to High level language with the help
of Compiler.
(Compiler is nothing, just a C++ software with the
help of which we run a program in our computer.)
Now, come back to C++ programming language
. C++ is very popular "High Level Language"
. C++ is General - purpose programming language
. Designed & Implemented by Bjarne Stroustrup in
1979 At Bell Labs.
. C++ is update version of 'C'.
. It run on a variety of platforms, such as Window,
MacOS, and the various version of UNIX.
. C++ Supports Object-Oriented Programming and
Generic Programming.
. C++ case sensitive and .cpp is an Extension of C++
files.
. C++ can be used to develop operating system,
Browsers, Games, and so on.
It is a deviation from traditional procedural languages
in the sense that it follows object oriented
programming (OOP) approach which is quite suitable
for managing large and complex programs.
STRUCTURE OF C++
The structure of a C++ program is given below:
# include <io stream>
A C++ program starts with function called main( ). The body of the function
is enclosed between curlyThe program statements are written within
theEach statement must end by a semicolon (;). A
C++ program may contain as many functions as required. However, when the
program is loaded in the memory, the control is handed over to function
main ( ) and it is the first function to be executed.Let us now write our first program: // This is used for single comment lines /* this is used for multi lines comments ..................................................................*/ cout <<“This is my first program in C++”; cout << “\n......................................”; When the above program is compiled, linked and executed the following output
is displayed on the VDUThis is my first program in C++ .Various components of this program are discussed First three lines of the above program are comments and are ignored by the
compiler. Comments are included in a program to make it more readable. If a comment is short and can be accommodated in a single line, then it is started
with double slash (//)sequence in the first line of the program. However, if
there are multiple lines in a comment, it is enclosed between the two symbols
/* and */. Everything between /* and */ is ignored by theThe lines in the above program that start with symbol‘#’ are called directives
and are instructions to the compiler. The word include with ‘#’ tells the compiler to include the file iostream.h into the file of the above program. File iostream.h
is a header file needed for input/output requirements of the program. Therefore, this file has been included at the top of the program.The word main is a function name. The brackets( ) with main tells that main
( ) is a function. The word void before main( ) indicates that no value is being returned by the function main( ). Every C++ program consists of one or more
functions. However, when program is loaded in the memory, the control is handed over to function main( ) and it is the first(iv) The curly brackets and body of the function main( ) : A C ++ program starts with function called main( ). The body of the function
is enclosed between curly braces. The program statements are written within the brackets. Each statement must end by a semicolon, without which an error
message isBefore getting into programming, it is important to
0 Comments