Creating a class in C++

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: 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...

Quick Sort

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...

Constructors and Destructors

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...

Friend function And Friend Class

Friend function:- 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. Multiply Subtract Divide  ...

Concept Of Data hiding & Encapsulation In C++

 Encapsulation: Defining data members and member functions together within a class is refffered as encapsulation. Without encapsulation the object oriented programming cannot be implement. Data hiding: In object oriented programming most of...

Objects and Classes in C++

Objects and Classes Introduction:- 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 default parameters (arguments) Or Function with parameters having default values  Consider the following program. # include void main ( ) { void disptime ( int = 8, int = 0, int = 0 ); disptime (,29,39); disptime...

STRUCTURES IN C++

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...

POINTERS in C++

Basics of Pointers :- Definition :- 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...

Arrays in C++

Arrays: 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 2)Multi-dimensional array. 1)      One-dimensional Array - Consider the following...

STORAGE CLASSES IN C++

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 (...

Functions in C++

Fundamental Of Functions:- There are number of fundamentals associated with the functions. To understand these fundamentals let us consider the following example. # include void main ( ) { int x, y, z; int add (int, int);       // function...

CONTROL STRUCTURES

Following are the control structures that are used in C + + : A) Decision Making Statements:- 1.if statement 2.if-else statement 3.switch statement B) Looping statements:- 1.for statement 2.while statement 3.do-while statement C)...

DATA INPUT AND OUTPUT

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...

Preprocessor Directives

Preprocessor Directives: 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...

Variables and cout,cin operator in c++

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...

Concept of DataTypes in c++

Data types In c++: Computer is of various types. It may include integers, characters, string etc. Types of Datatypes: 1.Integers 2.Characters 3.Strings 4.Floating point type 1.Integers: Integers are whole number such as 7, 12, 27, -7, -12, -27...

C + + Tokens

C + + Tokens : The group of characters that logically belong together is called Token.Tokens are of following 4 types:- 1. Identifiers 2.Keywords 3.Constants 4.Operators 1. Identifiers:  A program can use various data items with symbolic...

Powered by CjBlog