Monday

While loop

While loop :-
                           Firstly let's discuss what is loop? As we know the repetition of any thing regarding any topic is called loop. It's basic meaning is circle (repetition) of data but in common life or in common language it is treated as ring.
                                    Similarly the term while loop is used to make data in repetitive form and can also be used in many other ways. For example if someone wants to print tables then one can use loop process to print data by just writing program of one line and when we move towards art and such kind of things like drawing then we can also use while loop like if someone wants to print one's name by using characters like (/ - + , . ; ' " : = * & ^ % $ # @ ! ~ ) or any other shape by using such characters then one can also consult to while loop. The syntax is very simple and is shown in the following picture that how can we display integers from 0 to 10 :



At initial level we must stick to such easy programs and then we should move to the difficult one because in this way we will be able to perform well in the future because basic is very compulsory regarding learning of programing languages.






      

Sunday

Or operator

Or operator :-
                            This is also similar to the and operator. But in it the conditions which are given inside the if statement does not need to be fulfilled properly only one condition can be the cause of the execution of conditional statement.
                                                         The image is given below which can make the idea clear :


And operator

And Operator :-
                               We use this operator when we have to restrict our program by any other condition inside the if statement. In this way if the program fulfills the conditions which are given inside the if statement only then the conditional statement is printed.
                                                                                     The concept is made clear in the following image:

Friday

else if statement

else if statement :-
                                   If we want multiple conditions to be implemented on multiple statements then we use it and it is compulsory to us ' if ' condition with it but using 'else' condition is  not compulsory. The following program can make the idea clear.

if & else statements

if statement :-
                           As everyone knows even in english when we write if then in fact a condition is being gone to be implemented by us. Similarly here in C++ we use ' if ' when we want to implement any condition on any statement. When the condition is fulfilled only then the statement is executed.

         


if and else statements  :-
                            If by chance ' if ' statement does not fulfill then else statement is printed. In other words we can say it's the second option for compiler.

 





Thursday

cin object

cin object :-
                     It is used to give value to the variable after compilation time. Means if any variable has to be given a value after compilation then we use cin object. The syntax is cin >> a; .
The proper program  is given as follows :


For more programs click on the following link : http://pastebin.com/4W8yvvuE

Wednesday

Escape Sequences

Escape Sequences :-
                                   These are special non-printing words which are written to perform some specific task on the output which has to be displayed. It is combination of a backslash and a code character like \n, \a, \t, \v etc. And \n is used for next line and \a is used for alert. These combinations can be used anywhere in the first in the mid or at the end of the output.
An example is given as:


For source code click on the given link:   http://pastebin.com/wyZdxETr

 

Monday

Constants in C++

About constants :-
                                As everyone of us knows that a constant is something whose value can not be changed and in C++ program it works as it works in mathematics because in mathematics the constant have just one still value. In C++ program a constant can not be used like a variable because it does not have storage. There are different types of C++ constants (mostly of four types) and they are given below:

                      
  1. Integer. 
  2. Character.
  3. String.
  4. Boolean.
It is also very important to know that how a constant is given a name? The answer is as follows :
Assigning names to constants :-
                                                  Basically a constant is assigned a name by keeping an eye on all those rules on which we keep during assigning names to variables but an only thing which should be addicted that is the constants are preferred to be written in capital letters.

       

       Methods of assigning names :-

                                              There are specially two types of assigning names to the constants :
  • By using #define keyword or operator .
  • By using const keyword .

Both of the methods have been explained below with proper syntax.
1) By using #define keyword :-
                                              In this method constant is assigned name outside the main function's boundary. Equal's sign and terminator are not used. And the proper syntax is given below :

                                                    

2) By using const keyword :-
                                              In this type the name of the constant is assigned inside the main function's boundary. In it equal's sign and terminators are also used. The syntax is given below :

                                         



To find source code : http://pastebin.com/NFVeEAAA

Variables in C++

About variables :-
                                 In C++ programming language a variable is something which provides a storage which can also be changed as it is clear by it's name that a variable is something whose value can be varied.



 In C++ a variable is very important because a lot of programs consist on it.
                                                                                                                            The program in which the sum is stored in third value also consists on it and except for it there are a lot of more also. A simple program is given below:
                                                   
 
There are also some rules of assigning name to a variable and everyone should work upon those rules.

Rules of assigning names :-
                                                  The rules upon which an should be kept during when we assign names to any variable are given  below:

1) The name must include alphabets, numbers or underscore only like;
         int all_1;  is correct way of assigning name.

2)
Special characters (!,@,#,$,%,^, &,*,<,>,?) must not be the part of a variable's name like
         int all@1;   is wrong way of assigning name to a variable.

3) The name must be start by alphabets or by underscore. Other wise an error will be given.
         int all_1; or int _all1;
are correct  ways.    

4) The name should not start by numbers like;
         int 1_all; is also wrong way.

5)
There must not be any whitespace between the characters(alphabets, numbers or underscore) upon which the name of the variable consists like;
         int all 1; is also wrong way.


                              For source code click on :  http://pastebin.com/uDqGSwf8