Thursday, 11 September 2014

Program No.2
Write a program that declare two variables and then add them and show their result.



OUTPUT:-
In above program i declare 2 variables a and b assign 6 to a and 7 to b and then declare another variable named sum and assign 0 to it.Then i add a and b and store their result in sum through (=)
operator.This operator is used to assign a value to variable its called assignment operator.And then i show the value of sum which is 13.

NOTE;-
If we don't assign 0 to sum it give a garbage value in the result because at the time of its declaration its value is garbage mean's their is no value stored in it that is why first we will store 0 in it and then store the result of a and b.

Wednesday, 10 September 2014

Aslam.o.Alikum Students.....Today lecture is about Data Types


Data Types:-
Data Types tells a variable which type of data is stores in the variable.like integer data,character data,number data,frictional data,large data and small data.
you can easily understand with the concept of data types according to above pic.

These are the following Data Types in programming languages:-

  1. int
  2. char
  3. float
  4. double
  5. long
  6. long double
  7. bool
In above pic you can easily understand about data types.

 
First of all we will discuss about int.
Int Data Type:-
int is pronounced from integer.you know that what is  integer data?So int data type is used to store the integer data.
Examples of integer data:-
1,11,21,31,41,-56,-34.....etc.

Char Data Type:-
char is pronounced from character.And you know that what is character data type?So char data type is used to store character data and special symbols like @,#,$,%.
Examples of char data:-
a,A,K,k,f,G,$,@,&.......etc.
Note:-
The value of a character variable will always stored in single quotation marks.
         For Example char a='A';
here we define a char type variable and assign value 'A' to it.
Float Data Type:-
float data type is used to store the floating point or fractional values.And you know that what is fractional or floating point values.
Examples of float data:-
1.1,34.56,123.456........etc.
Student these are some data types which are more used in C++.So from today we will start proper programming practice.I shall produce code of program itself and the pictures of code and output of code will upload on this page through which you will seek better programming INSHA ALLAH....

And don't worry about other concepts i shall provide every concept of this language but with a schedule of time.Today i will start proper programs. And give the ideas of those topics which we not discuss now in future.......................!

I shall code a program in my PC and upload the code and the output of program and also give a brief information about the working of program.Mean's what will program do and what we are expecting from it.
All the codes of C++ are run on Microsoft Visual C++ 6.0.

             LET'S START STUDENTS PROGRAMS

Program No.1
Write a program which declare two integer type variables and show their values.


      
OUTPUT:-

In above program i define 2 variable one is 'a' and second is 'b' assign value 5 to a and 4 to b.
and show their values by using "cout" statement."cout" statement is used to show the message or value on the output screen or window.The message which you want to show as same on output window you will write it in double quotation marks(" ").If you want to show the value of variable on output screen you will write the variable name in(<< here you write the name of variable<<).

Monday, 25 August 2014

As you know that C++ is a computer language and far of human mind.It is only understand by computer.A programmer write a set of instructions in this language to perform the desired work from the computer.The computer read these instructions and give output according to the code.This set of instructions is called "code" also.
So the students i shall provide you the basic concepts of programming through which you will able to write and understand the programming codes.
Firstly I shall provide simple and easy information about these following topics.

  1. Declaration of Variables:-
  2. Data Types:-
  3. Difference B/W Initialization,Declaration and Assignment of variable:- 
  4. Comments:-
  5. Loops:-
Declaration of Variables:-
Variables are the basic and an important part of any computer language.We store values according to our need and then use these variables in the code to perform operations and get desired information.
There are some instruction or rules to declare a variable.These are as follows:-
  1. Variable name can be 1-30 character  long.
  2. It can include  A-B,0-9 and special characters.
  3. The name of variable cannot be start from a number.
  4. The name of variable can start from special character.
  5. Space cannot be used in the name of variable.
  6. _ is used at the start of variable name.
Syntax:-  Data Type     Name of Variable = Value;
In the Following picture you will be clear about Variable.

In above picture "int" is data type of variable and "answer" is the name of variable and "42" is the value which is stored in variable.And don't worry about Data type we discus this topic in detail.
According to syntax you can verify that the variable declared in the pic is correct.
This process of declaring a variable is called initialization.
Declaration , Initialization and Assignment of variable:-
There is a minor difference between declaration and initialization of a variable.  
In declaration of variable we declare a variable only and give no initial value to the variable.It means that we define only data type and name of variable in declaration.But in initialization we give a initial value to the variable but at the time of declaration of variable.
Following picture explain the difference between declaration,initialization and assignment:-


In above picture we declare a variable named "a"  having type "int" and store value "10" in this variable. 

Sunday, 24 August 2014

Aslam.o.Alaikum Students of C++.I shall provide you initial concepts of programming on this platform INSHA ALLAH.I hope all of yo will give a respective and informative responce.
Now we will start with the name of ALLAH.