header ad

Basic of C++ programming language | Introduction


If you are a developer and mainly code in the c++ programming language then you should need to learn about the basic concepts that are going to help you to enhance your coding skills. so in this tutorial, we are going to learn about the basic concepts of the C++ programming language.

Basic of C++ programming language | Introduction


What is A C++ programming language?

C++ is a programming language that was developed by Bjarne Stroustrup to create high-performance applications. it is a high-level programming language that was first introduced in 1998 as an extension of c programming language. also, it is a cross-platform language that gives us control over the system resources and memory used by the system. let's take a look at the versions of c++ programming language.

VersionsStandardRelease Date
C++98ISO/IEC 14882:19981998-09-01
C++03ISO/IEC 14882:20032003-10-16
C++11ISO/IEC 14882:20112011-09-01
C++14ISO/IEC 14882:20142014-12-15
C++17TBC2017-01-01
C++11TBC2020-01-01

Basic concepts of C++ programming.

If you want to start with the c++ programming language then you should have at least knowledge of basic concepts that used in c++ programming language.
  • #include - used for including a header file or source file in the program.
  • <iostream> - used to define the standard stream objects or functions that used to take input and print output on the screen.
  • <cstdlib> - used to define the general-purpose functions that can help us to manage memory, allocation of memory, and generation of random numbers.
  • <ctime> - used to manipulate the date and time information from the system to the program.
  • std - used to declare the c++ standard library features.
  • cin - used to read the input from the input device.
  • cout - used to write the output on the screen.
  • endl - used to write output on the new line.
  • argument - it is also known as a parameter and used to pass the information to the function.
  • break - used to exit from a loop or a statement like from switch, while, for, or do-while loop.
  • continue - used to skip the line from execution.
  • const - used to define a constant object.
  • heap - used for dynamic memory allocation.
  • exception - It is an error that occurs anomaly in the program.
  • <fstream> - It is a class of input/output stream to operate files.
  • integer - whole number from 0-9 and its combinations.
  • float numbers - a real number like 1.2
  • string - a sequence of characters.
  • character - a single character or symbol.
  • Boolean - It returns either false or true value.
  • int - keyword used to declare the integer variable.
  • signed - By default all the variables in c++ programming are signed. and it is used to hold negative and positive values.
  • unsigned - It can hold only positive (+ve) values.
  • float - keyword used to declare the floating variable.
  • char - keyword used to declare a character variable.
  • bool - keyword used to declare the boolean variable.
  • array - It is a type of data structure that holds the sequence of values of the same type.
  • pointer - used to store the address of an object.
  • NULL - It is a constant that denotes the value 0.
  • sizeof - used to find the size of an object in bytes.
  • void - it does not have any value.

Oops concepts in C++ programming

  • Instance - In c++ programming, each object is called an instance of a class.
  • Class - Class is a blueprint or combination of objects that contain variables, methods, and functions for performing a task.
  • encapsulation - it is a technique of packing data and functions into a single component.
  • inheritance - it is the process of accessing methods and members of one class into another class.
  • polymorphism - It means that if we call a member function then a different function is executed depending on the type of object that invokes the functions. means we can create more than one function with the same name and can call them for different work.
  • virtual function - it is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature.
  • abstract class - It is a class that has pure virtual functions. means the functions can only have declaration without the body. and an abstract class can only be a base class for other classes.

Basic c++ program with explanation

#include <iostream>
int main()
{
 std::cout << "Hello World!" << std::endl;
}

Explanation

#include <iostream> - It is a directive that used to include the header file iostream. so we can use the functions that are defined in the iostream file.

iostream - It is a c++ standard library header file that contains input and output functions. and these functions provide a way to get input from and output to an external system.

int main() - This is a function named main. in a c++ program, there must be only one main function and it must always return a number of the int type. and the main function is called upon the execution of the program.

{ } - These are the curly brackets in which we can define the body of the program. from the { open curly bracket the compiler starts compiling the program and at } close curly bracket the program stops executing by the compiler. just like in the above program we are printing the Hello World! message on the screen.

std - it is a namespace and :: is the scope resolution operator that allows for an object by the name within a namespace.

std::count - it is the standard output stream object that used to print the output on the screen and defined in the iostream file.

std::endl - it is a special input-output stream object that also defined in the iostream file that used to insert the end of the line to the string.

Keywords in c++ programming language.

alignas struct new
delete and_eq this
not_eq dynamic_cast bitand
true or explicit
break typeid protected
false char unsigned
using friend class
void signed inline
constexpr while static_assert
mutable decltype alignof
switch noexcept do
asm thread_local nullptr
else bitor try
or_eq export case
typename public float
char16_t char32_t return
goto compl volatile
sizeof int const_cast
xor static_cast namespace
default and template
not double auto
throw operator enum
bool typedef private
extern catch union
register for reinterpret_cast
virtual short if
const wchar_t static
long continue xor_eq

Post a Comment

0 Comments