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

Sunday

What is Clear screen

Clear screen (cls) :-
                                Clear screen is an operator which is used to make the screen be cleared. And it is commonly used when we want to remove all the data written before it

                                      

and it is part of the header file <stdlib.h> and it is compulsory to include the header file because it shows we have included it properly. For using this  operator cls command is used instead of whole clrscr ( ) function.
                                                                                                                                           The proper syntax of using it is given below :
  
                                                        










What is setw ( )

setw ( ) manipulator :-
                                   It's full form is set width and it is used to set the width of the output statement or screen. Mean's by using this manipulator we can restrict our output to the digits to which we want. The reference can be given by setw (n). 
                                                     Where n specifies the width of the out put screen and is an integer value. And if we want to use this manipulator then a header file <iomanip> is used because setw ( ) is part of this header file.

The proper syntax is given below
                                   
                                                    #include <iostream>
                                                    #include <iomanip> 
                                                    using namespace std;
                                                    int main ( )
                                                   {
                                                     cout << setw (10) << "Asia" << setw (8) << "Europe";
                                                     return 0;
                                                    }   

Saturday

What is sizeof ()

sizeof ( ) :-
                        About sizeof ( ) the simplest concept is just it is a keyword (the words which are already declared to the programming languages and there is no need to explain them again & again) as well as an operator.



 In C++ it is used to find the size of the data type which is declared to any variable or constant and it requires a proper syntax to be written down.
                                                                    A program which contains sizeof ( ) with proper syntax is given below :

                                                           #include < iostream>
                                                           using namespace std;
                                                           int main ( )
                                                          {
                                                            int a;
                                                            cout<< sizeof (a);
                                                            return 0;
                                                           }

What is Data Type

Data Type :-
                       Data type or in the simple form type is a type of classification or a group that contains and identifies one or more kinds of data.

                                 

                                  


 And it's examples are boolean, integer, real etc.. And it determines all the possible values of that type (which it contains). And data type is further split into two parts :


  1.  Primitive Built in type.
  2.  Reference type.


But here we will just discuss first type (Primitive built in type) because these are used in very vast range in C++ programming language.

Primitive built in type :-
                                        This is a type of data type for which the programming language provides built_in support. Means these are present in the built_in memory of the programming language. And they are further split into seven categories. And all these are shown in the following table :









Compiler in C++

History :-
                    It's important to know about the history of the thing about which we want to know. The first compiler was written by    Grace Hooper 



in 1952 for A-0 system language. For this the term compiler was also used by Hooper. Another important thing which must be addicted that is the A-0 system language was used by Harvard Mark 1 and the device was also invented by Grace Hooper with the assistance of Howard Aikens and by the Howard University it was called Mark 1 for increasing it's capacity compiler was developed. And the first C++ compiler was developed by    Dennis Ritchie



 in 2011 and since that time up to now the IT professionals are trying to make the capacity of compilers be more enhanced.

What is compiler ?
                  In computing a compiler is a program that processes statements written in a particular programming language

                                         

                                                                                                               and turns them into the source statements written in machine (away from human understanding or low level language) language or code, which the computer's processor uses. Now the question is what are source statements? 
                                                                                                                                        The question may be answered as typically users may use Pascal, C, C++ or some other kind of languages so at the time of conversion each line at one time uses an editor to convert itself into the machine language and after the conversion a file is created by which all the lines are contained is known as source statement. Many conferences have been done regarding the improvement of the compiler's capacity and efficiency. Names of some organizations are mentioned below who are working on it's progress :
  • Programming language design and implementation. (PLDI)
  • Principles of programming languages. (POPL)



  • Object oriented programming, system, languages and applications. (OOPSLA)
  • International conference on functional programming. (ICFP)

Friday

White spaces and white lines

White spaces :-
                             Those spaces on the C++ environment page which are unoccupied by any character, word or line or we can say the spaces which are left empty are known as white spaces. And these are ignored by the compiler and we use it for our own assistance.




White lines :-
                           The lines which are totally occupied by white spaces are known as white lines. And these are also ignored by the compiler.


Thursday

Comments in C++

Comments :-
                                      In C++ programming language comments are the single line or multiple (more then one) line statements which are used by the programmer for his own assistance (help) are known as comments.



And they are totally ignored by the compiler. In it programmer can write anything by which he can be helped. In C++ programming language comments are commonly used to highlight something and also have a proper syntax in which they are written down.

There are two types of comments :

1) Single line comments :-
                                 As it is clear by it's name that the comments which depend upon one line are called single line comments and it's length never exceeds from one line. And it's syntax is the comment is written after double forward slashes //. 
For example :
// This line includes header file which is <iostream>.
#include <iostream>    

2) Multiple line comments :-
                                        The comments which depend upon more then one line are called multiple line comments. And regarding it's length there is no restriction it's length can exceed any limit. It's syntax is it starts with /* and ends with */.
For example :
/* int main ( ) is starting point of a program and in cout that line is written which has to be printed and semicolons are the statement terminators. */
int main ( )
{
  cout<< " Welcome ";
  return o;
}





What are keywords

Keywords :-
                         When we have a deep view on the word keyword then we come to know that it is combination of two words Key and Words as we know key is something by which locks are opened and it can also be said the words which themselves are keys to open certain locks or  to perform certain special tasks are called keywords.

                                               Now lets have a look towards the real concept of keyword, it can be defined as the words which are already given to  the computer program and have certain meanings to them and there is no need to explain these words again and again are called keywords. For different purpose a different keyword is used such as endl, do, or, if and else etc are the different keywords for different purposes.


Wednesday

What is endl

endl :-
                endl is a keyword which is used to end the current line or terminate the present statement. And we use it if we want the next statement to be printed in the next line. And another interesting thing is that it is short form of end of line which makes it more clear that it is used to end the current line. And in program it is also used with proper syntax.

                 The syntax is:
                 
                                            #include <iostream>
                                            using namespace std;
                                            int main ( )
                                           {
                                             cout << "Hey..!" << endl << "How are you..?"; 
                                             return 0;
                                           }
       
    We will use this syntax if we want ( Hey..! ) to be printed in the first line and ( How are you..? ) to be printed in the next line. Hence, by using this basic syntax critical programs can also be prepared. 

Basic information about C++ program

Simple C++ program :-
                              As the syntax of simple C++ program has already described in the previous topic of syntax. But, as it was also told the word syntax will be repeated again and again. So, lets have an overview that what is syntax? So it can be explained as the way of writing down a program by keeping all rules and regulations in front of you which are compulsory for the proper execution of a program, like adding header files, specifying regions, and proper standard library.
   
So here a simple program is shown below:
               

#include <iostream>
using namespace std;
                                                                int main ( )
                                                               {
                                                                cout<<"Welcome";
                                                                return 0;       
                                                               }

#include <iostream> :-
                                           In the above program the first line is [ #include <iostream> ]



 in it the word #include is syntax of writing down a C++ program and as it is already explained before that syntax is compulsory with proper  rules and regulations so it is also compulsory.'
                                                                                               Now lets move to the next part that is <iostream> so it is important to be addicted that it is Header file.

 Now the question is what is header file ? The question can be answered as it is the file which includes all the functions which are to be performed and we can also make the idea clear for the instant by saying that it includes all the inputs (which has to be taken from the programmer) and outputs (which has to be displayed on the screen after the execution). And it is present in the standard library.
Using namespace std :-                                                                                             
                                 Now, lets move to the next line that is [ using namespace std; ].This line tells the compiler to use a group of functions that are part of the standard library (std).




        In it using is a keyword and also the syntax of this line which shows the usage of the namespace and std.
Lets discuss what is namespace ? So, it can be answered as 
                                                                                   1)A namespace is a declarative region that provides a scope to the identifiers (the names of types, functions, variables, etc.) inside it.
                                                                                            2)Namespaces are used to organize code into logical groups and to prevent name collisions that can occur especially when your code base includes multiple libraries.                                        
                                                                                   3)All identifiers at namespace scope are visible to one another without qualification.

Overall the basic concept is, it provides caliber or boundary or region to the compiler by which it prevents to get confused between two things of the same category. For example if we perform a task of volume gain then compiler will be confused because the function, gain in volume is performed in music library and in physics library also. If we want our program to make a sensible execution then it is compulsory to use namespace because in this way compiler will know which task to perform.  
                                                                                                            Now the term which was left is std, so about it now the concept must be restricted to just, it is short form of standard and we can also say it is standard library which includes all the header files and the header  file <iostream> which we discussed above is one of it's header files.

int main ( ) :-
                              For this part just the only concept which we should have to keep in our mind is it is the starting point of a program. Means program starts from this point and all the lines written before are the syntaxes.

cout<<"Welcome"; :-
                                           cout is used to print the lines or words which we have to print. And it's proper way is to write the line or word in inverted commas as shown in above written program with proper logics.


   



return 0; :-
                        After writing a proper program at the end return 0 is written because if we do not write it then whenever we give any input to the program then after the execution in spite of closing the display the program will not be stopped but keep on running which causes a burden on the RAM so that's why return 0 is used because it tells the compiler that the output has displayed and 0 output is left so automatically program will be stopped and any kind of loss will not be occurred or not even expected.
                       
Blocks :-                               
                       The logically connected statements are called blocks. And these lines are written in curly braces { } . The logics are << , "" etc...

Semicolons :-
                              Semicolons (;) are the terminators which are used to end the statements because when any statement ends then it is just visible to us not to the compiler so in order to make this scenario clear to the compiler we use terminators or also can say semicolons.




Tuesday

C++ program syntax, pseudo code and algorithm.

(NOTE: During the time when you study about C++ program your focus must be only on the concept.)




Syntax :-

             The word syntax describes the way in which something is written down or typed on the computer. Now for sometime forget about the C++ program. Initially it is compulsory to make the idea of syntax clear because this term will be used again and again.
                                                                           And it is also said that it is the set of rules, principles and processes which are to be implemented and if these are neglected then the task will not be declared correct. Similarly it works in our programs and important as well. It means without it program is not program but just a pseudo code. And the term syntax is not restricted to Programming language but is also used in many other fields. There are many types of syntax but as it's types are not part of the topic so you must save yourselves to get entangled to study deeply about it.
           

  -:The syntax of C++ program is given below:-                   


#include <iostream>
using namespace std;
                                                                int main ( )
                                                               {
                                                                cout<<"Welcome";
                                                                return 0;       
                                                               }
                    
                                                                                                     As discussed in above paragraph the question arises what is pseudo code? This question can be answered as it is a simple way of of writing down a program or any instruction step by step in simple english or any other language. As our topic is Programming language so we will just stick to writing down program in simple way and in a proper sequence.

                               
                                        If we discuss pseudo code then another thing relevant to it must also be discussed that is Algorithm. So, it's definition is almost similar to pseudo code. It is defined as the step by step process of writing down instructions, but only one point is contradictory between pseudo code and algorithm that is pseudo code is written in simple english or any other language but an algorithm has specified or we can say proper language in which it is written down.






Basic info about programming languages

Programming Language:-
                                                         To make the idea clear that what is programming language initially let's have a view that what is program? So, it is termed as a set of written instructions which are written down to perform a specific task which we want to. Now we must go through the definition of programming language because in this way it's basic concept will be delivered. Definition: Simply,the languages in which a program is written or we can say codding is done is known as programming language.like C, C++, Java, Java script etc...




Basically three types of Programming languages exist which are given below:  

1) First one is Machine level or Procedural Programming language: Language which requires sequence of statements to execute the program like C, COBOL, Fortran, etc...

2) Second one is High level or Functional Programming language: Language which uses some functions to perform the required task on the stored data an important example is data sorting out function. ML, Haskell, and Erlang etc are some of the examples.                                                                                 
3) Third one is Middle level or Assembly or Object Oriented Programming language: For those who are at the starting point of learning programming the concept is limited to, "it is a language which uses an object or a class of objects to perform a specific task like C++,C sharp, Java and Java script etc...
                                  


  Click on the following link to make the idea properly clear
                                             
                                                     https://youtu.be/J1qLdYRv81Y


   
(NOTE: Initially we will just discuss C++  because if we occupy something's roots then it becomes easy for us to get the working principle of that thing. So now a days C++ is considered as basic to learn about high level Programming languages.)


C++ Programming language:- 
                                                 This programming language was developed by Bjarne Stroustrup 






in 1979 at Bell Labs 




during when he was doing work for his Ph.d thesis. He was the IT professional who got success in developing it. It was needed by the professionals for the very long time and many of the IT professionals were trying to develop the language which could perform better then the previous one because the computers were getting very popular in that era and the tasks which computers had to tackle and manage were getting sensitive and critical so there was need of it because before the availability of this language the language which was used was not of very good quality and could not perform some of the tasks which this one can. 
                                                                        So, now it will be easy to get the idea about C++, the simple description of C++ is it is a middle level programming language




 means it performs both, the tasks which are performed by low level programing languages and the tasks which are performed by high level programming languages as well. It is said to be middle level programming language because it is more near to machine and far away from the human. The meaning of this statement is its easy for our PC's to understand it but when our brains come to know that what tasks are being performed at the back end then it is too much difficult for us.