C++ Programming Tutorial

 
 
 

Object Oriented Programming

Structures

Example of structures Passing structures to function Passing structure pointers to function Pointers and an array of structure Relationship between union and structure Array of structure Nested structures Self-referential structures Linked List

Classes

Classes with inline functions Classes without using inline functions Example of constructor in classes Passing values to constructor in classes Overloading of constructors in classes Example of destructor in classes Example of static class data Example of static member functions Constant objects, constant member functions Strings as member of classes Use of arrays as data items in classes Example of array of objects in classes Use of pointer this using header file this.h Obj initialize, assign by default member wise copy

Inheritance - Containership

Example of Inheritance Over riding base class member fn in derived Diff in public, protected, private inheritance Multi-level inheritance Multiple inheritance Example of containership

Virtual Functions - Polymorphism

Example of Polymorphism Example of Pure Virtual functions

Operator Overloading - Type Casting

Increment operator ++ overloading w/o return type Increment operator ++ overloading - return type Decrement operator -- overloading w/o return type Decrement operator -- overloading - return type Operator overloading for strings Comparision operator < overloading Binary operator + overloading creating new object Binary operator + overloading w/o creating object Binary operator - overloading creating object Binary operator - overloading w/o creating object Binary operator * overloading w/o creating object Stream insertion >> , extraction << operators Data conversion b/w built-in data types Data conversion - built-in, user defined data type Conversion- built-in, user defined data type- char Data conversion user defined data type - function Conversion user defined data type - constructor

Friend Functions and Classes

Use of friend functions Use of friend classes Operator overloading using friend function All Operator overloading using friend function Addition of 2 matrix using friend function Example of friend function of a class

Template Functions and Classes

Interchange value using function template Example of template classes Template based array input Template to find minimum value in an array Template of vector class

File Processing - Command Line Arguments

Open file File operation program - diff type of mode Read from one text file, writing in new text file File read, write, update and display operations Read decimal from file - convert into hexadecimal Read words from file and remove palindrome Read device data from text file and show extension Example of binary files

General Programs

Number of days b/w two given dates Capitalize first charcter of every word in string Copy n num of characters from one to another Word is palindrome or not using classes & pointers Simulation of the Solar System Add and Subtract functions on Big Number Class
 
 

Image

 #include<iostream.h>
 #include<conio.h>


 //--------------------------------  Str  --------------------------------//


 struct str
    {
       int number_1;
       float number_2;
    };


 //---------------------------------  uni  -------------------------------//


 union uni
    {
       int number_1;
       float number_2;
    };


 main()
    {
       clrscr();

       struct str structure_element;
       union uni union_element;

       cout<<\"\\n ********** Structure Elements **********\"<<endl;

       cout<<\"\\t Enter the value of number_1 = \";
       cin>>structure_element.number_1;

       cout<<\"\\t Enter the value of number_2 = \";
       cin>>structure_element.number_2;

       cout<<\"\\n ********** Union Elements **********\"<<endl;

       cout<<\"\\t Enter the value of number_1 = \";
       cin>>union_element.number_1;

       cout<<\"\\t Enter the value of number_2 = \";
       cin>>union_element.number_2;

       getch();
       clrscr();

       cout<<\"\\n ********** Structure Elements **********\"<<endl;

       cout<<\"\\t Value of number_1 = \";
       cout<<structure_element.number_1<<endl;

       cout<<\"\\t Value of number_2 = \";
       cout<<structure_element.number_2<<endl;

       cout<<\"\\n ********** Union Elements **********\"<<endl;

       cout<<\"\\t Values of number_1 = \";
       cout<<union_element.number_1<<endl;

       cout<<\"\\t Value of number_2 = \";
       cout<<union_element.number_2<<endl;

       cout<<\"\\n\\n ********** Structure Elements **********\"<<endl;
       cout<<\"\\t Size of structure_element = \"<<sizeof(struct str)<<endl;

       cout<<\"\\n ********** Union Elements **********\"<<endl;
       cout<<\"\\t Size of union_element = \"<<sizeof(union uni)<<endl;

       getch();
       return 0;
    }

    Related Post:
  1. Program to show the 3D Shearing Transformation along z-axis

  2. Program to construct Clamped Cubic Spline Interpolant from the given data

  3. Program to illustrate the different features of an array of char known as string

  4. Program to computes the product of two matrices of size 4x4 using Divide and Conquer Strategy

  5. PROGRAM FOR ACCEPTING MEASUREMENTS IN METERS AND FEETS AND SUMMING THEM UP IN THE FORMAT THAT THE USER WISHES

  6. Program to estimate the Differential value of a given function using Runge-Kutta Methods

  7. Program of declaration of default arguments during creation of function

  8. Program that computes and displays the factorial of the given number using recursion

  9. Program to illustrate adding values to the contents of variables whose addresses are in pointers

  10. Program that take font and background color and text input from a user and display it in right aligned

  11. Program to illustrate the use of reference variables

  12. Program to show the implementation of Sutherland-Hodgeman Polygon Clipping Algorithm

  13. Program to implement the Prims Algorithm to solve Minimum Spanning Tree Problem (MST)

  14. Program of Nicol Lee Nicol Algorithm for Line Clipping

  15. Matrix program to display matrix

  16. Program to show the implementation of Hashing with Insert, Delete and search functionality using double-ended Linked List

  17. Mini Project School Management Application

  18. Program to convert an Infix Expression into a Postfix / Suffix Expression without parenthesize

  19. Program to illustrate the Merge Sort

  20. EXAMPLE OF WRITE FUNCTION

 
 
Didn't find what you were looking for? Find more on Program to illustrate the relationship b/w union and structure