January 30, 2013

Manipulators in C++ (OOPs)

manipulators in C++ (OOPs)


Some standard manipulators are used in C++ (OOPs) which are stored under header file iomanip.h. Under this it has capabilities to show inter-conversions like binary, decimal, hex-decimal, set the precision for more accurate answer and various other functions like you can see in the programs.

Structures in C++ (OOPs)


implementation of structures in programming from day to day life in C++ (OOPs)

Structure is the user defined data type which can store heterogeneous data i.e. data of different types. It means in structure member with all possible data type can be used and there is no restriction that elements of the structure are stored at adjacent memory locations. Structure is declared with key word struct followed by its name and then by block. 

Pointers in C++ (OOPs)


syntax and working of showing how pointers points to its particular value in C++ (OOPs)

Pointer is that variable which stores the memory address of another variable. It means pointer is itself a variable which stores hex-decimal address of the location.

Strings in C++ (OOPs)


various strings operation that are stored under header string.h

January 29, 2013

Arrays in C++ (OOPs)


chess array banner with king and queen in C++ (OOPs)

Array is an arrangement of same type of data at adjacent memory locations. Array is useful whenever large volume of data is to be processed and stored in the memory.

Suppose an average marks are to be calculated from all the students in the school. This is difficult to find the sum of marks of all students. In this situation an array is the best alternative. Its divided in two categories:

1. Single / 1-D Array
2. Multi-dimension Array

Loop Control- Nested for in C++ (OOPs)

/* Program to enter order of the matrix and print stars*/


#include<iostream.h>
#include<conio.h>
main()
{
       int m,n,i,j;
       cout<<"\n Enter order of Matrix m*n";
       cin>>m>>n;
       cout<<"\n";
       for(i=0;i<m;i++)
       {
                       for(j=0;j<n;j++)
                       {
                                       cout<<" *";
                                       }
                       cout<<"\n";
                                       }
       getch();
       }
output of program to display star matrix of any order using nested for loop in C++ (OOPs)

Loop Control- for loop in C++ (OOPs)



loop control statement banner of for loop in C++ (OOPs)

“for” loop is also structure control loop as program will run or execute if the initial condition is true otherwise it will terminate and program will run until some condition is fulfilled.

FORMAT:
for(expression1;expression2;expression3)
{
Statement1;
Statement2;
}

Switch Statement in C++ (OOPs)



switch statement banner ON OFF in C++ (OOPs)


This statement is also used for decision making. Here key word is switch followed by control variable and followed by it’s block.
In the block of switch statement multiple cases are used and each ends with break statement this is also called as early exit loop.
Out of all the cases only that case will run whose value matches with the control variable.

Loop Control- While & Do-while in C++ (OOPs)


loop control statements banner of while and do while loop in C++ (OOPs)

These are used for repeating some portion of the program either by specified number of times or until a particular condition is true.
1. while statement
2. do while statement
3. for loop

Decision Making- Nested If else in C++ (OOPs)

if else ladder (Nested if else) statements in C++ (OOPs) programming language banner


This statement can be used to select any one statement or a block which contains a set of instructions. Only that statement will execute which is true according to the data entered and rest other conditions will not executed.