Monday, 29 April 2013

History of C++

History of C++

C++ was developed by Bjarne Stroustrup at AT & T Bell Laboratories in Muarry Hill, New Jersy (USA) in 1983. C++ is an OOP i.e. Object Oriented Programming, which allows programmers to develop large and complex applications. The OOP languages existed before C++ were slow and inefficient.

So, Bjarne Stroustrup who was a great admirer and master of C and SIMULA 67, combined the features of both the languages into more powerful language. This combination of features of SIMULA 67 and C resulted in a new language called C with Classes by Bjarne in 1979. C with Classes lacked some OOP features. Therefore some features and ideas were taken from ALGOL 68 (Algorithmic Language). Thus it resulted in C++. The name C++ is credited to Rick Mascitti who suggested this name and was first used in 1983. It is named C++ not C+ or ++C because C+ has been used as the name of an earlier unrelated language and C++ is more commonly used than ++C. Moreover, it is not named D language because it is an extension of C.

Version                year
1.0                    1983
2.0                    1989
3.0                    1992

Creator of C++: Bjarne Stroustrup.


Brief History of C++

  1. During 1970 Dennis Ritchie created C Programming language.
  2.  In the early 1980′s, also at Bell Laboratories, another programming language was created which was based upon the C language.
  3. New language was developed by Bjarne Stroustrup and was calledC++.
  4. Stroustrup states that the purpose of C++ is to make writing good programs easier and more pleasant for the individual programmer.
  5. C++ programming language is extension to C Language.
  6. In C we have already used increment operator (++) . Therefor we called C++ as “Incremented C” means Extension to C.

Tuesday, 16 April 2013

Simply Explained Iterative (Looping):


Iterative (Looping): Iterative is also known as looping. It is used when we want to execute a statement again and again. The process of executing a statement again and again is known as loop. Such type of statement is known as iterative or looping statement. Loop statements are categorized in two controls: entry control loop and exit control loop. Entry control loop is the loop where condition is checked at entry point. If it is true then body of loop is executed. Otherwise the control is moved out of the loop when condition becomes false. Entry control loop is also called base loop. The while-loop and for-loop are example of entry control loop. Exit control loop is the loop when condition is checked at exit point. If condition is true then body of loop is executed otherwise not. The example of exit control loop is do-while loop statement. Each loop has the same purpose i.e. repeating the task again and again till condition becomes false. The basic loop statements are:
while loop
do while loop
for loop


1) while loop: While loop is an entry control loop. First of all, the condition is checked at entry point. If it is true then body of loop is executed otherwise loop is terminated. This loop will execute again and again till condition becomes false.
General syntax of while loop:
initialization;
while(condition)
Notes By:
Vijay Kumar Bhargav (98728-71471)
{
   statements;
   incre/decre;
}
Example of while loop:
#include<stdio.h>
#include<conio.h>
void main()
{
     int w;
     w=0;                                                            //initialization
     while(w<5)
     {
         printf("\n my name is while loop");       // executable statement
         w++;                                                       // increment
     }
       printf("while loop is terminated");
       getch();
}
2) do-while loop: The do while loop is an exit control loop. In this loop the condition is checked at exit point. First of all body of loop is executed then condition is checked. If condition is true then body is executed again, otherwise not. It is also known as do-loop. Body of loop is executed till the condition becomes false.
General syntax of do loop:
initialization;
do
{
    statements;
    incre/decre;
} while(condition);
Note that in while loop there is no semi colon at the end but in do while there is semi colon at the end when while (condition) is written. Example:
#include<stdio.h>
#include<conio.h>
void main()
{
    int d;
    d=0;                                                             // initialization
    do
    {       printf("i am do while loop");
       d++;                                                         // incre/decre
    } while(d<5);                                              // condition
   printf("exited from do while");
   getch();
}
3) for loop: The for loop is an entry control loop. In this loop, condition is checked at entry point of loop body. Every loop has three parts: initialization, condition check and increment/decrement. In other loops all three parts initialization, condition check and increment/decrement are written at separate places. But in for loop, all three parts are written at same place in single line.
General syntax of for loop:
for(initialization; condition check; incre/decre)
{
   body of loop;
Notes By:
Vijay Kumar Bhargav (98728-71471)
}
Example of for loop:
#include<stdio.h>
#include<conio.h>
void main()
{
    int i;
    for(i=0;i<5;i++)
    {
       printf("i am for loop");
    }
   getch();
}
Each loop has the same purpose i.e. repeating the task again and again till condition becomes false.


4) nested for loop: When a for loop occurs within another for loop then it is known as nested for loop. We can apply number of nested for loops in C language.
General syntax of nested loop:
for(initialization; condition check; incre/decre)
{   for(initialization; condition check; incre/decre)
            {          body of inner loop;
            }
       body of outer loop;
}
In nested loop, inner loop will be executed first then outer loop will be executed. Example:
#include<stdio.h>
#include<conio.h>
void main()
{    int i,j;
     for(i=0;i<3;i++)
     {
       for(j=0;j<3;j++)
       {  printf("this is inner loop");
       }
          printf("this is outer loop");
     }
    printf("exit from all loops");
    getch();
}

Blog Author: Vijay Kumar