Ayush Gupta has Published 541 Articles

Insertion and Deletion in STL Set C++ program

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:18:48

342 Views

In this tutorial, we will be discussing a program to understand the insertion and deletion in STL set in C++.The set is a container element. The properties that make it unique is that it can only contain unique elements and they can be looped over in a sorted manner.ExampleInsertion Live Demo#include ... Read More

Input Iterators in C++

Ayush Gupta

Ayush Gupta

Updated on 01-Apr-2020 06:16:13

280 Views

In this tutorial, we will be discussing a program to understand input iterators in C++.Input iterators are one of the five iterators in STL being the weakest and simplest of all. They are mostly used in serial input operations where each value is read one and then the iterator moves ... Read More

Delete elements in C++ STL list

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:48:31

133 Views

IIn this tutorial, we will be discussing a program to understand how to delete elements in the C++ STL list.For this, we will be using the pop_back() and pop_front() function to delete the element from last and the front respectively.Example Live Demo#include #include using namespace std; int main(){    listlist1={10, 15, ... Read More

Initialization of a multidimensional arrays in C/C++ Program

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:39:05

119 Views

In this tutorial, we will be discussing a program to understand how to initiate a multidimensional array in C/C++.While declaring a multidimensional array, the value of the leftmost dimension can be left empty, but all other dimensions must be provided.Example Live Demo#include int main(){    int a[][2] = {{1, 2}, {3, ... Read More

Extended Integral Types (Choosing the correct integer size in C/C++)

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:37:36

86 Views

In this tutorial, we will be discussing a program to understand extended integral types in C/C++.The data types in C are very loosely defined. Their range values changes on the basis of the compiler being 32 or 64 bit. To specify the compiler range you want to use in your ... Read More

Finding Floor and Ceil of a Sorted Array using C++ STL

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:34:51

169 Views

In this tutorial, we will be discussing a program to find the floor and ceil of a sorted array using C++ STL.To find the floor and ceil of a sorted array we will use lower_bound() and upper_bound() functions from STL respectively.Example Live Demo#include using namespace std; //finding floor of given ... Read More

File Handling through C++ Classes

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:32:06

699 Views

In this tutorial, we will be discussing a program to understand File Handling through C++ classes.The default functions used in file handling to interact with files can be defined by the user using classes. Below is the implementation of ifstream and ofstream functions.Example#include #include using namespace std; int ... Read More

Draw a line in C++ graphics

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:30:09

4K+ Views

In this tutorial, we will be discussing a program to draw a line in C++ graphics.To implement different shapes and sizes, animations, graphics.h library is used in C++.Example#include int main(){    int gd = DETECT, gm;    initgraph(&gd, &gm, "");    line(150, 150, 450, 150);    line(150, 200, 450, 200);    line(150, 250, 450, 250);    getch();    closegraph();    return 0; }Output

Does C++ compiler create default constructor when we write our own?

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:27:02

134 Views

In this tutorial, we will be discussing a program to understand if the C++ compiler creates a default constructor when we write our own.Generally, the C++ compiler uses the default constructor when no one is defined, but always uses the one defined by the user if any.Example Live Demo#include using namespace ... Read More

Delete and free() in C++ Program

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:24:21

73 Views

In this tutorial, we will be discussing a program to understand delete() and free() functions in C++.Both of these functions are primarily used for the same purpose i.e freeing up unused memory. The delete() operator is for the ones allocated using new() and free() for the ones allocated using malloc().Example#include ... Read More

Advertisements