Saturday 11 June 2016

BASICS OF C++ PROGRAMMING

ABOUT C++ 

○ C++ is a programming language
○ C++ is a middle-level programming language
○ Developed by Bjarne Stroustrup starting in 1979 at Bell Labs
○ C and C++  become a widely used programming language
○ C++ fully supports object-oriented programming (OOP's).
OOP's is a model of programming language. or It is a Concept.


FEATURE OF C++

○ C++ is Easy to learn and Understand.
○ C++ is usually considered a "multi-paradigm" language.
○ It produces more efficient programs.
○ It can also handle low-level activities as well as high level activities
○ It can be compiled on a variety of computer platforms.
○ C++ is an object oriented programming language therefore it supports
        1. Polymorphism (one name and many forms)
        2. Encapsulation (wrapping of a data & function in single unit)
        3. Data Abstraction ( hiding of data and showing important features)
        4. Inheritance (deriving data from one class to another)
        5. Data Banding (communication between objects)
○ C++ is not portable. (means source code is runs anywhere but exe file does not run )   



USES OF C++


○ C++ is used by thousands of programmers to develop an application .
○ C++ is used to write device drivers and other software's
○ C++ is widely used for research
○ The primary user interfaces of systems are written in C++ (specially for windows and mac).




REQUIREMENTS  (ENVIRONMENT SET UP)


○Actual C++ compiler, which will be used to compile your source code to executable program.
○Most C++ program extension is name.cpp
○Most used and free available compiler  are listed below ...click for download 


EXAMPLE OF A C PROGRAM 



#include<iostream.h>      //header file

int main()

{

cout<<"Hackers Rocks";  // used to display
return 0;   // function to returning something.
}


Explanation:-

1- Comment:
◘ It is the statement in the programs which compiler ignores.
◘ It increases readability of the program.
◘ Comments are of two type, single line and multi-line comment.

2- Header File:
◘ iostream is a header file.
◘ iostream stands for "Standard input output".
◘ It contains definition of input/output facilities in C programming.

3- Main():
◘ whenever parenthesis " () " are used. It is called function in C programming.
◘ main() function is like the entry point in the program.

4-cout:
◘ cout is also a function.
◘  " << " is called excertion operator.
◘ the definition (work ) of cout is, to display whatever is written after the  << and ;(semicolon) .
◘ the definition of cout is given by iostream.h file.



After Compilation  

When ever you compile your source code ... then the compiler generate 4 types of files 
○ name.cpp (source code file)
○ name.bak  (back up file)
○ name.txt  (normal text file)
○ name.exe (executable file)
 all four types of file ...you can find in C Drive --> Program Files-->turbo c++ -->bin --> all files present here....after successful compilation.


BOOKS 

○ Object Oriented Programming with C++      - E Balaguruswamy
○ Let Us C++      - Yashwant Kanetkar
○ C++: The Complete Reference     - Herbert Schildt


No comments:

WINDOWS SUBSYSTEM FOR LINUX

Microsoft partnered with Canonical (creator of Ubuntu) to bring Linux environment experience in Windows 10. Through Windows Subsystem F...