-moz-user-select:none; -webkit-user-select:none; -khtml-user-select:none; -ms-user-select:none; user-select:none;

Saturday 21 February 2015

Adding numbers by taking input from the user

Asalam o alikum
This blog will help you how to create a program by taking input from the user.

#include<iostream.h>
#include<conio.h>
void main( )
{
clrscr( );
int a,b,c;
cout<<"Enter the first number=";
cin>>a;
cout<<"Enter the second number=";
cin>>b;
c=a+b;
cout<<"Result="<<c;
getch( );
}

Output


Wednesday 18 February 2015

Adding two numbers in C++

Now,I am going to make a simple program that will add two numbers without taking input from the user.

1. #include<iostream.h>
2. #include<conio.h>
3. void main( )
4. {
5. int a=5;
6. int b=6;
7. c=a+b;
8. cout<<"Result="<<a+b;
9.  getch( );
10. }


Result


Tuesday 17 February 2015

Your first program in C++

I hope you have viewed my previous blogs about programming and translators.
Now we will start with a basic program of C++.This basic program will help you to print a simple statement.So,lets start programming.I recommend you to use Turbo C++ for simple programming.
1. #include<iostream.h>
2. #include<conio.h>
3. void main()
4.{
5. cout<<“Welcome to my blog”;
6. getch();
7. }

Output:

Welcome to my blog

Sunday 15 February 2015

Translators in C++

Translator 

translator is a one that converts the instructions of a high level language program into the instructions of a low level language program.
Just take the example of  ambassadors of different countries.They speak different languages but there is a translator who translate one language to another.In this way,they understand the sayings of each other.
In the same way,a computer cannot understand the instructions of high level language program.So it must be converted into machine language code by a translator so that a computer may understand it easily.
There are normally 3 types of translators in the world of programming:

1. Compiler :-

A compiler converts the instructions of a high level language program into machine code as a whole.It means that it display the errors after compiling the whole program.It is faster in execution than other translators.The disadvantage is that error is not found immediately.

2. Interpreter :-

An interpreter converts the instructions of a high level language program into machine code step by step. It means that it display the errors after compiling each line.The main advantage is that error is found immediately .The main disadvantage is that it is very slow in execution.

3. Assembler :-

An assembler converts the instructions of an assembly language into the instructions of a machine language.

Saturday 14 February 2015

Introduction to Programming

The set of instructions given to computer to perform execution is known as a program and the process of writing the program is known as programming.
A person who develops the program is known as a programmer.
There are mainly two types of programming languages:
1. High level languages
2. Low level languages
The languages that are close to human language and far away from machine language are known as high level languages.e.g.,JAVA,C++,Fortran,etc.These languages are easily to understand for the users and difficult to understand for the computer.These languages are less closer to computer hardware than  machine languages.
The languages that are close to machine language and far away from human language is known as low level languages.e.g., Machine language, Assembly language(Assembly language is also called middle-level language),etc.These languages are difficult to understand for the users and easier to understand for the machine.These languages are closer to computer hardware than high level languages.