Introduction to C++ Programming Language
C++ programming language, as we as a whole know is an extension to C dialect and was produced by Bjarne Stroustrup at chime labs. C++ programming language is a middle-level dialect, as it involves an affirmation of both abnormal state and low-level dialect highlights. C++ programming language is a statically composed, free shape, multiparadigm, assembled broadly useful dialect.
C++ Programming Language is an Object Oriented Programming dialect, however, isn't absolutely Object Oriented. Its highlights like Friend and Virtual, abuse a portion of the essential OOPS highlights, rendering this dialect unworthy of being called totally Object Oriented. Its a centre level dialect.
Advantages of C++ over C Language
The significant distinction being OOPS idea, C++ programming language is a question arranged dialect while C dialect is a procedural dialect. Separated shape this there are numerous different highlights of C++ programming language which gives this dialect a high ground on C programming language.
Following highlights of C++ makes it a more grounded dialect than C,
- There is a Stronger Type Checking in C++ Programming Language.
- All the OOPS includes in C++ like Abstraction, Encapsulation, Inheritance and so forth makes it more commendable and helpful for developers.
- The C++ programming language underpins and permits client characterized administrators (i.e Operator Overloading) and capacity over-burdening is additionally upheld in it.
- Exemption Handling is there in the C++ programming language.
- The Concept of Virtual capacities and furthermore Constructors and Destructors for Objects.
- Inline Functions in C++ rather than Macros in C dialect. Inline capacities influence finish capacity to body act like Macro, securely.
- Factors can be announced anyplace in the program in C++, yet should be proclaimed before they are utilized.
Uses of C++ Programming Language
C++ is utilized by developers to make PC programming. It is utilized to make general frameworks programming, drivers for different PC gadgets, programming for servers and programming for particular applications and furthermore broadly utilized as a part of the formation of computer games.
The C++ programming language is utilized by numerous developers of various sorts and originating from various fields. C++ programming language is, for the most part, used to compose gadget driver programs, framework programming, and applications that rely upon coordinate equipment control under ongoing limitations. It is additionally used to educate the essentials of question arranged highlights since it is straightforward and is likewise utilized as a part of the fields of research. Additionally, numerous essential UIs and framework records of Windows and Macintosh are composed utilizing C++. Along these lines, C++ is extremely a prevalent, solid and much of the time utilized programming dialect of this advanced programming time.
Features of Object Oriented C++ Programming Language
- The main focus remains on data rather than procedures.
- Object-oriented programs are segmented into parts called objects.
- Data structures are designed to categorize the objects.
- Data member and functions are tied together as a data structure.
- Data can be hidden and cannot be accessed by external functions using access specifier.
- Objects can communicate among themselves using functions.
- New data and functions can be easily added anywhere within a program whenever required.
- Since this is an object-oriented programming language, it follows a bottom-up approach.
Syntax and Structure of C++ Programming Language
Here we will discuss one simple and basic C++ program to print "Hello this is C++" and its structure in parts with details and uses.
First C++ program:
#include <iostream.h>
using namespace std;
int main()
{
cout << "Hello this is C++";
}
Header files are included at the beginning just like in C program. Here
iostream
is a header file which provides us with input & output streams. Header files contained predeclared function libraries, which can be used by users for their ease.
Using namespace std tells the compiler to use the standard namespace. Namespace collects identifiers used for class, object and variables. The namespace can be used by two ways in a program, either by the use of
using
statement at the beginning, like we did in the above-mentioned program or by using the name of the namespace as a prefix before the identifier with scope resolution (::) operator.
Example :
std::cout
<< "A";
main(), is the function which holds the executing part of the program its return type is
int
.
cout <<, is used to print anything on the screen, same as
printf
in C language. cin and cout are the same as scanf
and printf
, the only difference is that you do not need to mention format specifiers like %d for int etc, in cout & cin.
Comments
For single line comments, use // before mentioning comment, like
cout<<"single line"; // This is single line comment
For multiple line comment, enclose the comment between /* and */
/*this is
a multiple line
comment */
Thank You for read this blog post..
0 comments:
Post a Comment