Class is a key feature in C++. It makes programming much easier. To implement the class we need to create objects for that class. So, let's start with 'what is a class and an object?'
Class: Class is basically a template of variables and member...
DYNAMIC MEMORY ALLOCATION:
Dynamic memory allocation is the means by which a program can obtain memory while it is running. Global variables are allocated storage at compile time. Nonstatic , local variables use the stack. However, niether global...
This is a technique to sort a given array in an acending order.
Here is the steps we follow while performing quick sort :-
The last element of array is assumed to be "infinity".
" i " (which is an integer type variable) point to the lowest...
When objects are declared that is constructed for a particular class then this objects will occupy certain memory locations. The data members of these objects will have garbage values. In object oriented applications we will prefer that this values...
The concept of friend function goes against the concept of date hiding.
The friend function is declared within the class and it is defined outside of the class.
The friend function is not a member function of the...
Develop a class to represent complex number. The class should have following member function.
A fn to get the CN from user.
A fn to display the CN
A fn to add the two CN which are accepted as parameters.
Defining data members and member functions together within a class is refffered as encapsulation. Without encapsulation the object oriented programming cannot be implement.
In object oriented programming most of...
Objects and Classes
In c language we can define our own datatypes using structures. Therefore it is possible to develop application oriented datatype. We can define data elements as members of structure in c. However c do not...
Function with default parameters (arguments)
Function with parameters having default values
Consider the following program.
void main ( )
void disptime ( int = 8, int = 0, int = 0 );
Introduction to structures :-
1) The c + + allows us to create our own data type. Due to this facility, programmer can create his or her own data type for a specific application.
2) A structure is nothing but group of data elements, which can be...
Basics of Pointers :-
The pointer is nothing but an address. The pointers are useful for indirect access. The pointers are useful for the implementation of call by address.
Declaration of pointer variable –
The general syntax...
Array is nothing but group of elements where all the elements are of same type.
The two broad categories of the array are
1) One dimensional array
1) One-dimensional Array -
Consider the following...
The variable declared in the pgm will have certain storage class. The storage classes that are used in c++ one namely auto, static, register and extern.
1) Auto and static storage class:-
Consider the following pair of pgms
void main (...
Fundamental Of Functions:-
There are number of fundamentals associated with the functions. To understand these fundamentals let us consider the following example.
void main ( )
int x, y, z;
int add (int, int); // function...
Following are the control structures that are used in C + + :
A) Decision Making Statements:-
B) Looping statements:-
DATA INPUT AND OUTPUT:-
Input /output (I/o) functions are directly performed by C + +. These are the header files which help in performing input/output function. cin and cout functions help in performing input and output activities. Cin and cout...
The processor directives are the Direction given to the compiler to carry out specific task even before compilation of the program start. Since we are directing the complier to carry out specific task before the compilation...
As the name suggest, a variable is a quantity which varies during a program execution. In C + +, a variable is 0 location where the information is stored. This location exist in a computer memory where the value information can stored and a case...
Data types In c++:
Computer is of various types. It may include integers, characters, string etc.
Types of Datatypes:
4.Floating point type
Integers are whole number such as 7, 12, 27, -7, -12, -27...
C + + Tokens :
The group of characters that logically belong together is called Token.Tokens are of following 4 types:-
A program can use various data items with symbolic...