Introductions of C++ language

Introduction:
  • C ++ language proposed by Bjarne Stroustrup in 1979 at Bell Labs. 
  • It is middle level object-oriented programming language.
  • Initially, the C++ language is called ‘C with classes’ later changed to c++.
  • The C++ extension is .cpp
  • C ++ is bottom up approach.
  • It is used to create system applications like games, drivers, and so on.
For more details about the uses of the C++ language, click the below link to learn.
https://www.whereisstuff.com/2020/09/why-you-should-keep-learning-cc.html
Why c++ is required?
  • The C++ program is updated versions of C language.
  • Bjarne Stroustrup wanted an efficient and flexible language similar to C that also provided high-level features for program developers.
  • In C language graphics does not support in the program, for the reason for C++ found.
If you need more details about which one is better C or C++ then click the below link to learn.
https://www.whereisstuff.com/2020/09/why-c-language-is-better-than-c.html
Basic structure of C++:
Syntax:
  1. //Command line
    <header files>
    {class definition};
    main function()
    {
    variable declaration
    I/O operation
    }
    {user defined function}
Example:
  1. #include<iostream.h>
    #include<conio.h>
    void main()
    {
    int a,b,c;
    clrscr();
    cout<<"\n Enter a and b value : ";
    cin>>a>>b;
    c=a+b;
    cout<<"\n Addition of a and b value is:"<<c;
    getch();
    }
Program explanation:
  • # - It’s called pre-processor and used to replace the values in variables.
  • include -  It’s used to adding header files and user programs.
  • iostream.h  - Standard input and output stream header file(it holds cout and cin of library files).
  • conio.h - Stands for console input and output header file(used in old MS-DOS compilers to create text user interfaces and it holds clrscr() and getch() libraries).
  • void main() - Main part.
  • int – Datatype.
  • a,b,c – Variables.
  • clrscr() – Refresh output screen.
  • cout – Used to display the user entered details.
  • \n – It is used to go to next line(enter process in keyboard)on the output screen.
  • cin – Used to get the value from the user and put it into the memory location.
  • c=a+b – Addition process and stored result in c variable.
  • getch() – Used to hold the output screen and wait until the user gives any type of input(i.e until the user press any key).
Output:
Output process in the backend:
Output backend process explanation:
Step 1: Write source code that is your program (refer above example program).
Step 2: Pre-processor.
  • For example,
  •  a and b value is 10 and 4 then pre-processor replace the values.
  • cin<<10<<4;
Step 3: Complier (convert the English language to machine level language).
  • To check the error and convert machine-level code (i.e. 0’s and 1’s).
Step 4: Assembler.
  • After checking an error then it shows on screen.
  • So we want to convert machine level language to human-readable language. (0’s and 1’s to normal text).
Step 5: loader and linker.
  • Adding header files and pre-processor program.
Step 6: Final output.
Note:
Class and user define function will deeply discuss.

Share:

No comments:

Post a Comment

Popular Posts

Search This Blog

Powered by Blogger.

Blog Archive

Service Support

Need our help to Learn or Post New Concepts Contact me

Blog Archive

Recent Posts

Service Support

Need our help to Learn or Post New Concepts Contact me