add

Sunday, 29 January 2017

Introduction of C++ & Basic Structure of C++ Programming

Well Come to C++ Programming
Lecture # 01 by Sajid Ali
Introduction:

Program:

Definition:

A precise sequence of step to solve any particular Problem using any programming language is known as computer program.
I always follow this quotation of Alan Perlis – Yale University:
“It goes against the grain of modern education to teach children to program. What fun is there in making plans, acquiring discipline in organizing thoughts, devoting attention to detail and learning to be self-critical? “
For example you have a problem like this (write a program to calculate area of ring)
Those time you can write the program if you follow the above Alan Perlis points.

Programming Languages:

High level languages:

Just as human beings communicate with each other through the use of languages such as English. Programmers use a variety of programming languages to communicate with the computer.
Eg. C, C++, Visual Basic, C#, and Java

Assembly language

Slightly more advanced programming languages are called assembly languages. The assembly languages simplify the programmer’s job by allowing the programmer to use mnemonics in place of the 0s and 1s in the program. Mnemonics are memory aids—in this case, alphabetic abbreviations for instructions.
Eg. MULL, ADD etc.

Low level language

Within a computer, all data is represented by microscopic/tiny electronic switches that can be either OFF or ON. The off switch is designated by a 0, and the on switch is designated by a 1.
Actually there are main two types of Programming languages but assembly meets with high level & low level Language.

Good books For C++ Programming:

If you read this two books I hope you will be a good Programmer in C++
·         C++ Programming From Problem Analysis to Program Design [5th Edition] By DS Malik
·         How to program C++ [5th Edition] By Deital & Deital

      Required IDEs For C++:

·         (Dev C++ 5.1 Version, Turbo C++,code block or Borland C++ )

Simple Program Structure Of C++:


 
#include <iostream>
Using namespace std;                                                std use for display output
Int main ( )
{             cout << “ Hellow World :“;
 ( ””  ) inverted comas use  for as it is print your text on screen
         Terminator (;) terminate your program statements
    return0;                                       
           this show your return type because your main type is integer
        }
v  Curly braces shows your program start to stop;

Pre-processor Directive/Header

It is an instruction given to the compiler before the execution of actual program.Include preprocessor directive is used in C++ to include header files in the program.
             # include              <iostream>



Preprocessor Directive                      Header files

Main ( ) Function:

It is the starting point of a C++ program. C++ statements are written in the body of the main () function.
   int main( )
                                {
                                                Body of the main function
                                }

Course Content:

Important Topics in C++
       Basic C++ Programming construct
       Structured Programming
       Functions
       Arrays
       Pointers
       Strings
       Dynamic Memory allocation
       File handling
       Exception handling
       Structure & union
       OOP
       Data structure
       template
       Graphics
       Vectors
       Event handling