HISTORY OF C ++ LANGUAGE

HISTORY OF C ++ LANGUAGE

In 1979, A Danish Computer scientist Bjarne Stroustrup was working on his PhD thesis. He was motivated enough to design C with Classes. Stroustrup found that Simula language was very useful but it was far too slow for practical use. He then started developing a language like C with features of Simula and some other programming languages. In 1983, it was finally named C++ and it built-in some add-on features such as classes, inheritance, in-lining, default function arguments, polymorphism, encapsulation and solid type checking. The founder of C++ language was Bjarne Stroustrup.
In 1983, this language having features of C with classes was renamed to C++. The ++ operator in C++ means the advancements in C language or replacement of C programming. In 1985, 1st commercial edition of C++ was released. The language was yet to systematize. In 1989, the official standard version 2.0 was released. In 1998, the standard committee of C++ released the first international standard ISO C++ 98. In 2003, the C++98 was reviewed fixing the bugs and the name of the revised language was dubbed as C++03. Since then many versions are being released and used all over the world. Stroustrup also won the 2018 “Charles Stark Draper Prize ‘for conceptualizing and developing the C++ programming language’.

The difference between C and C++ are as follows:

  1.  C is a simple procedural language with no classes and OOP stuff whereas C++ was the language with all these things and extra features as well.
  2.  C++ is a refined version of C; C++ can run most of the C code whereas C cannot
  3.  C is function driven and C++ is an object driven language
  4.  Data hiding is not supported in C whereas it can be done in C++, which is also known as encapsulation.
  5.  C does not support function and operator overloading but C++ does
  6.  C++ supports exception handling. C doesn’t.

Types of Programming languages

There are 3 main types of programming languages

  1. Machine Language
  2. Low level language
  3. High level language

 

Machine languages are the languages used at the lowest level where 1’s and 0’s are used for communication.
Low level languages are easier than machine language as they have English words so that a programmer can easily write codes for the machines and interprets as well. It includes assembly language and etc.
High level languages are the one we use now a day to communicate with our machine and to develop software and programs on our personal computers. It is less like machine language and more like human language. However, for a computer to understand and run a program created with a high-level language, it must be compiled into machine language.

Types of Programming languages

In 1950’s for the very 1st time high level languages were used. Now a days high-level languages are in extensive use. These include BASIC, C, C++, FORTRAN, Java, Pascal, Perl, Python, Ruby, and Visual Basic and etc.

TYPES OF PROGRAMING LANGUAGE  PROCESSOR

A programming language processor is considered to be a formal method for translating from any specified High or Low Programming languages to machine language.

Following are the types of language processors we have:

  1. Compiler
  2. Assembler
  3. Interpreter

TYPES OF PROGRAMING LANGUAGE  PROCESSOR

C++ and its use

C Plus Plus is a programming language used across the world by developers, students and various other people for their day to day programming routine. It is very popular among world best companies like Google, Facebook, YouTube and various other giant organizations. C++ is the main language which is used at the back end of these Big Organizations what’s more, is almost twice as regular as the normal language over these Groups. It is also being used in android development and is quite popular there as well. Well their things and stats were for the geeks. C++ is also being used for the Game development as well. According to research round about 50% of the total gaming engines in the world use C++ as their base programming language, that’s some whooping stats. Banking applications such as the Infosys Finacle used C++ as one of the back-end languages. Multithreading and its high-level speed impress coders and it automatically become their first choice in such applications.

C++ and its use

HOW WE SOLVE PROBLEMS BY USING C++ AND DEFINE WAY OF SOLVING PROBLEMS

C++ is a tricky language and in order to fully contain and comprehend its vast amount of information multiple programming books are normally recommended, among which, however, C++ PROGRAMMING BOOK: FROM PROBLEM ANALYSIS TO PROGRAM DESIGN is the most common and undoubtedly the most important one. D.S Malik, the author’s, masterpiece not only provides a solid spotlight on critical thinking embedded with relatable examples it also challenges the reader through an unscrambling series of end-to-chapter exercises.

 

 

Programs that are written in C++ are extremely effective in memory use, exceptionally productive in CPU utilization and also the compilers of C++ are highly common, which is a big help for coders as guidance from the community is necessary for successful programming. What makes C++ one of the most commonly used programming languages is its speed that is faster than most other programming languages benefitting the users furthermore with great paralell support. It is also very near to the computer hardware which gives it extra edge on other programming languages.
As a result of the aforementioned reasons, C++ is used in finance, computer games, high-performance embedded and real-time systems, transportation, manufacture, and other industries where determinism and accuracy are critical. This makes C++ the 6th most used and subscribed tag, with the highest ever answer rate (84%) on Stack Overflow, a website every programmer is familiar with. It is known that over 600 notable programming languages are present as of this moment among which C++ stands on the highest of ranks.

Solving Problems using C++

5 STEPS OF PROGRAM DEVELOPMENT PROCESS

  1. Planning or Flowcharting
  2. pseudocode
  3. Algorithm
  4. Coding
  5. Debugging

There are several ways in which we can solve a problem using C++.

Flowchart:

A graphical representation in a specific sequence/order showing what a computer program does. It’s the 1st step when a programmer starts programming a software as it helps a lot in the next stages of Program development.

Flowchart:

The main characteristics of flowchart are:

  • It should contain of symbols that are acceptable and according to standard.
  • The symbols should be used correctly and in accordance to the flowchart rules.
  • The statements written inside the symbols must me short, clear and understandable.
  • The steps must be and in a meaningful manner.
  • Must be indicated clearly where the flowchart starts and ends.
  • Must consist of common and acceptable keywords such as INPUT, PRINT, WRITE or READ.
  • Arrows must be used to indicate where the flow of instructions is.

The following example is to print the highest number among 3 inputs.

Pseudocode:

A thorough however reasonable clarification of what a PC program must do written in clients’ characteristic Language rather than C++ is known as Pseudocode.

Pseudocode:

Pseudocode is once in a while utilized as a point by point venture during the time spent building up a program. It permits Team Leader to coordinate the structure in incredible detail and gives software engineers a point by point layout to the subsequent stage of composing code in C++ programming language. Since pseudocode is definite yet meaningful, it tends to be looked into by the group of Software Quality Assurance Engineers and Programmers as an approach to guarantee that genuine writing computer programs is probably going to coordinate plan particulars. Its likewise supportive it mistakes are repaired now as its less expensive at this stage rather to troubleshoot the code subsequent to coding the entire Program.

Characteristics of a good pseudocode are:
⦁ It must demonstrate the algorithm distinctly
⦁ It should not have any expressions or sentences from natural language
⦁ It must be free from any programming language
⦁ Its language structure must not be thoroughly free, yet it should be more adaptable and open                                          than programming language syntax
An example is given below:

  1.  Input 3 numbers for values A, B and C
  2.  If A >B
  3.  And A>C Then
  4.  Print A as the greatest Number
  5.  Goto Step No: 15
  6.  Else
  7.  If B>C
  8.  And B>A Then
  9.  Print B as the greatest Number
  10.  Goto Step No: 15
  11.  Else
  12.  If C>A
  13.  And C>B Then
  14.  Print C as the greatest Number
  15.  Stop Processing

Algorithm:

An algorithm or algo is a finite number of steps by step procedure before writing the actual program. Its mainly written in Programming language for the easy understanding of all.

Algorithm:

The main characteristics of algorithm are:
Finiteness: The number of steps in an algorithm must be finite.
Uniqueness: All steps must be unique and there should be no repetition.
Input: There must be input for which the algo has to run.
Output: There must be an output for the specified Input
Effectiveness: Generally an algorithm is expected to be effective. By this we mean that all of the steps to be performed in the algorithm must be satisfactorily basic that they can be done accordingly and in a finite length of time.

Coding:

Software programming is also known as coding. Coding or in other words line of code written in C++ language to execute a program is finite number of lines of code. C++ language is one of the programming languages widely used in the whole world to write codes for different software/programs.

An example of above mentioned problem is:

#include <iostream>
using namespace std;

int main()
{
int number1, number2, number3;

cout << “Enter three numbers: “;
cin >> number1 >> number2 >> number3;

if(number1 >= number2 && number1 >= number3)
{
cout << “Largest number: ” << number1;
}

if(number2 >= number1 && number2 >= number3)
{
cout << “Largest number: ” << number2;
}

if(number3 >= number1 && number3 >= number2) {
cout << “Largest number: ” << number3;
}

return 0;
}

Debugging:

Debugging is used to identify the errors in the program lines of code. The debugger or SQA engineer debugs the program and report them to programmer. Afterwards the programmer removes the error and makes the program bug free.

Debugging:

Steps in writing the program

1-C++ program starts with including the libraries among which the most important ones are ‘iostream’ and ‘string’ libraries which help in standard input output functioning.
Example:
#include <iostream>
#include <string>
2– Where ‘#include’ is used in order to add the libraries in your program.

3– Then a line ‘using namespace std’ is added. This line is added because otherwise we would have to write ‘std::’ before every line in which an input/output operator (cin/cout) has been used. Also, an important thing that must be remembered is that you should always add a semicolon ‘;’ at the end of every statement unless it’s a preprocessing statement (e.g. #inlcude <iostream>).
Example:
#include <iostream>
#include <string>
using namespace std;

4– Every C++ program must start with a function called ‘main’. This function can have ‘int’ or ‘void’ return type. However, the procedures for using each of these return types are different. When using ‘int’ return type the user must return the value ‘0’ at the end of the ‘main’ function to confirm that the execution of the program went successful. On the other hand, ‘void’ return type does not require any value to be returned.
Example:

Return type: int Return type: void
#include <iostream>
#include <string>
using namespace std;
int main()
{
//…YOUR CODE HERE
return 0;
} #include <iostream>
#include <string>
using namespace std;
void main()
{
//…YOUR CODE HERE
}

5– The code you want to execute must be written in the ‘YOUR CODE HERE’ section labelled in the example given above.

Example: (using ‘int main’ because it is commonly used and preferred)
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout<<”This is C plus plus article”;
return 0;
}
6– The above given program will print out ‘This is C plus plus article’ on the console.
Note: if you want to pause the screen and see the line you just printed, an additional line ‘system(“pause”);’ before the statement ‘return 0;’ must be added otherwise, the screen will disappear before you even have a decent look at the programs output.
Example:
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout<<”This is C plus plus article”;
system(“pause”);’
return 0;
}