Ayush Gupta has Published 527 Articles

Input Iterators in C++

Ayush Gupta

Ayush Gupta

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

401 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

258 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

218 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

138 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

Draw a line in C++ graphics

Ayush Gupta

Ayush Gupta

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

6K+ 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

228 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

181 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

Different methods to reverse a string in C/C++

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:22:23

3K+ Views

In this tutorial, we will be discussing a program to understand different methods to reverse a string in C/C++.ExampleUser-defined reverse() function − Live Demo#include using namespace std; //function to reverse given string void reverse_str(string& str){    int n = str.length();    for (int i = 0; i < n / ... Read More

Default Arguments in C++

Ayush Gupta

Ayush Gupta

Updated on 23-Mar-2020 08:18:52

1K+ Views

In this tutorial, we will be discussing a program to understand default arguments in C++.Default arguments are those which are provided to the called function in case the caller statement does provide any value for them.Example Live Demo#include using namespace std; //function defined with default arguments int sum(int x, int y, ... Read More

Customizing termination behavior for uncaught exception In C++

Ayush Gupta

Ayush Gupta

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

357 Views

In this tutorial, we will be discussing a program to customize behavior for an uncaught exceptions in C++.Usually, the exception is handled by the try-catch block, but there are instances where there isn’t a matching catch block and the program just terminates. This terminate() function is modifiable as per user ... Read More

Advertisements