Saturday 15 October 2016

What is the use of terminator ?

Terminator is used to ending every statement in C++. Terminator is a semicolon " ; " put at the end of  each statement.

Rule to write a program in c++

There is not a hard and fast rule to write a program in c++. You just have to put terminator ";" (semicolon) at the end of a statement.

What is an error and what are its types ?

Error:

An Error is a mistake that occurs in a program. The error may be a syntax error,logical error or may b a runtime error.

Syntax Error:

To understand what is a syntax error firstly you have to understand that is a "syntax".
A syntax is a collection of rules to write a program in any programming language is called as syntax.

Now, what is a syntax error ?
A syntax error is a type of error that occurs when we write an instruction which is not according to the rules of programming language or when we write an invalid statement.
Example: missing terminator at the end of any statement in C++ program.

Logical Error:

A logical error is a type of error that occurs due to the mistake of human logic.

Example: Suppose you write a program to find the marks of students how has marks greater than 60. You put less than " < " operator instead of putting greater than " > " operator. This error is called as a logical error.

Runtime Error:

A runtime error is an error that occurs during the execution of a program.

Most common example of runtime error is dividing any number by 0.

What is the most difficult error to find ?

The answer is "Logical Error" because the compiler does not understand it. It only can be solved by rereading the code.

Thursday 13 October 2016

What is the basic structure of C++ program ?

Basic Structure:

Here I am going to tell you what is the basic structure of a C++ Program.
A syntax or a pattern to write a program is called as structure.
Here is the basic structure of C++ program:


Preprocessor Directives:

Preprocessor directives are included on the top of any C++ program. These are used to add header files to a program. Preprocessor directives start with the # sign and a keyword "include" is used with start angle bracket and end angle bracket.
Example: #include<conio.h>

Another way of including header files is #include "conio.h" but the better way to add header files is above method.

Header File:
Header file contains the libraries and function about what to do in program... like "iostream.h" it contains the input and output libraries and also general math functions.
A header file has the extension of ".h".

Main Body:

Main body contains the code section of the program. It is the place where the actual working of a program starts. All variable declaration, initialization and other things like comments are mention there.

What is c++ ?

C++ is a High-Level programming language which is used to write programs. It is easy to learn.
C++ is an OOP Object Oriented Programming. It was invented in 1979 at Bell Labs. It is used to develop applications, software and device drivers. For more history, you can visit Wikipedia.

Tuesday 11 October 2016

What is interpreter ?

Interpreter:

Interpreter is a program that also does work of compiling like compiler but the difference is that it converts only one line at one time.

The disadvantage of the interpreter is that it is slow than compiler but provide the facility to check code line by line where an error comes it stops compiling until the line is free from error.

What is compiler ?

Compiler: 

A Compiler is a program that converts the instructions written in High-Level Programming Language to Machine Language.

A compiler converts a program into object code as a whole.
Source Code: The instructions written in High-Level Programming Language is known as source code.

Object Code: The instructions written in Low-Level Programming Language is known as object code.

What is programming language ?

Programming Language:

Programming Language is a language which is used to write programs. There are many programming languages available to write programs depending on nature.

Example: C++,C#.net,VB.net etc

Types of Programming Languages:

There are main two types of programming languages which are as follow:
  1. High-Level Programming Language
  2. Low-Level Programming Language

1. High-Level Programming Language:

High-Level Programming Language is a type of programming language which is closer to human and far from the computer.Closer to human means human can easily understand it and far from computer means computer can't understand it directly.

A compiler is required to convert high-level instruction to that which is easily understandable by the computer means machine language.

Example: C++, C# and many others.

2. Low-Level Programming Language:

Low-Level Programming Language is a type of programming language which is close to the computer and far from the human which is easily understandable by the computer and not for human.

It is further divided into two categories:
  1. Assembly Language
  2. Machine Language

Assembly Language:

A type of Low-Level Programming Language which is closer to the computer but in it, there are English-like words are used that are called as mnemonics.

An assembler is required to convert assembly language instructions to machine language.

Example: FORTRAN

Machine Language:

Machine Language is a type of Low-Level Programming Language which is the native language of the computer. It is the language that is directly understandable by the computer. No compiler is required. All work is done in computer in machine language means binary form.

What is difference between Instruction and Information ?

Instruction:

                       Instruction is a command in a program that tell the computer to do something.

Information:

                     In data processing cycle data is given as input to computer and processed in into output.
The output of the data or the processed form of data is called as "Information",

What is a program ?

A program is a set of instructions which is given to a computer to solve a task or problem.

Example to understand a program is let suppose a task is to "play a song" and the program is the "vlc player"
The song will be given to vlc player to play it.
Thanks!

C/C++ Tutorials - for beginners to learn basics of Programming Language

C/C++ is a programming language which is basically learned by every person in every institute. This language is the basic language for almost all programming languages. If you learn it easily then you have the ability to learn other programming languages.

I have created this blog to teach basics of C/C++ programming language.

Overview about Program and Programming Language

Programming Overview - about program and programming overview.
To understand what is program and programming language?