• 19 May

    Get Type of Object in C++

    C++ is an object-oriented language where we often interact with objects of different types. The object interaction becomes more interesting when we add runtime polymorphism to it. The runtime polymorphism, also known as, dynamic dispatch of methods, or method overriding means that a class can override the implementation of a method defined in the parent […]

  • How to initialize an array in Constructor in C++
    23 April

    How to initialize an Array in Constructor in C++

    This article discusses methods of initializing an array in constructor in C++. Let us first discuss arrays and constructors in C++. Arrays Arrays are fundamental data structures. It is basically a collection of elements of the same data type stored in a contiguous memory location. Arrays in C++ can be made up of primitive data […]

  • Write String to file in C++
    31 March

    Write String to File in C++

    The files are used to store the data permanently on a disk. This mitigates the problem of loss of data when the program stops execution. On the other hand, strings are the most common data type to store the text data in C++. This article discusses methods to write string to file in C++. Using […]

  • Print Array in C++
    23 March

    Print Array in C++

    An array is a data structure that stores similar data items at contiguous memory locations under one variable name. The elements in an array can be accessed using indices. This article discusses the arrays and how to print array in C++. Introduction of Arrays For a small number of data items, you can use different […]

  • Print Vector C++
    23 March

    Print Vector in C++

    This article discusses the vector and how to print vector in C++. Vectors are similar to dynamic arrays in that they can resize themselves automatically when an element is added or removed. The container automatically handles the size of the vector. Elements in a vector are stored in contiguous memory locations. You can traverse these […]

  • 18 March

    Write Vector to File in C++

    This article discusses different methods to Write Vector to File in C++. Vectors in C++ are sequential containers similar to arrays. However, vectors need to have a fixed size. On the other hand, files facilitate the storage of data permanently to the disk, therefore, mitigating the data loss even after the program stops execution. Write […]

  • Print Map in C++
    15 March

    Print Map in C++

    Maps in C++ store the data in form of key and value pairs. Each value is identified by a key and no two keys are the same. Maps are widely used in problems that involve searching large data such as a database, cache applications, data compression, etc. This article discusses the two different types of […]

  • How to write binary files in C++
    14 March

    Write Binary Files in C++

    In this post, we will see how to write binary files in java. The binary files are similar to the text files however the content in binary files is stored in binary format rather than simple text format. The binary files can come in handy for storing complex objects such as structures, and classes. This […]

  • Read file line by line in C++
    17 February

    Read File Line by Line in C++

    C++ is a multi-domain programming language. It is widely used in embedded systems, game development, operating systems, etc. Therefore, we often come around situations where we need to read input from a file. Files are a great way to store the data permanently on the hard disk which is otherwise lost if the program exits. […]