Tapas Kumar Ghosh

Tapas Kumar Ghosh

185 Articles Published

Articles by Tapas Kumar Ghosh

185 articles

Errors in C/C++

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 28-Jul-2025 13K+ Views

In C/C++, an error occurs due to an invalid operation performed by the user. The error normally stops the program execution until it is fixed. So, the error should be removed before compilation and execution. Types of Error in C/C++ Following is the list of errors occur in C/C++ programming: Syntax Error Run-Time Error Linker Error Logical Error Semantic Error In this article, we will see the implementation of error in C/C++ programs. Syntax Error The syntax error ...

Read More

All pair combinations of 2 tuples in Python

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 11-Jul-2025 384 Views

Python tuples are immutable sequences that used to store collections of items. When working with two tuples, you may sometimes need to generate all possible pairs, where each pair contains one element from the first tuple and one from the second. In this article, we will learn different ways to generate all pair combinations from two tuples Following are input-output scenarios for pairing combinations of two tuples: Input: first_tuple = (1, 3) second_tuple = (7, 9) Output: [(1, 7), (1, 9), (3, 7), (3, 9), (7, 1), (7, 3), (9, 1), (9, 3)] Explanation: At index 0 of first_tuple pairs ...

Read More

Aligning table to X-axis using matplotlib Python

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 11-Jul-2025 2K+ Views

The Python Matplotlib library allows us to create visual plots from given data. To make the data easier to read and relate to the chart, we can display it in the form of a table and position it directly below the corresponding bar chart. Since the x-axis runs horizontally, we arrange the table in the same direction so that each value aligns correctly under its corresponding bar. Based on this concept, we demonstrate the diagram as follows: Steps to Align a Table to the X-axis Using Matplotlib Following are the steps to create a table and store data ...

Read More

Age Calculator using Python Tkinter

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 11-Jul-2025 2K+ Views

An age calculator in Python using Tkinter is a GUI (Graphical User Interface) application that allows users to determine their age based on their date of birth (DOB). To design the user interface of this application, we use various methods provided by the Tkinter library such as Tk(), pack(), Entry(), Button(), and more. GUI of Age Calculator Let us build a GUI-based age calculator where the user can enter their age in the format of years, months, and days. Ensure that single-digit numbers are prefixed with a 0. Creating an Age Calculator Application using Python Tkinter To create an ...

Read More

All possible concatenations in String List Using Python

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 11-Jul-2025 2K+ Views

All possible concatenations in a string list means to generate every possible combination of strings by concatenating two or more elements from a given list of strings. In this article, we are given a string list and we need to find all its possible concatenations. Following are the input-output scenarios for concatenating string's list: Scenario 1 Input: X = ['TP', 'Tutorix'] Output: ['TP', 'Tutorix', 'TPTutorix', 'TutorixTP'] Explanation: When the list contains two strings, say 'TP' and 'Tutorix', it returns two more additional possibilities like 'TPTutorix' and 'TutorixTP'. Scenario 2 Input: X = ['AP', 'BQ', 'CR'] Output: ['AP', 'BQ', 'CR', ...

Read More

C++ Program to Implement Sparse Array

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 01-Jul-2025 3K+ Views

What is Sparse Array?Sparse array is used to determines the dimension of an array in which most of the elements are zero. It can be used for matrix calculation. Characteristics of Sparse Array Following are list of points that defines the characteristics of a sparse array: Most of the elements are zero or null values which means it is unused. Only non-zero elements and their indexes are stored. It is used to save the memory while comparing to normal array calculation. Example The Sparse array of ...

Read More

What are the rules for calling the superclass constructor C++?

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 01-Jul-2025 12K+ Views

In C++, a superclass serves as a base/parent class. When we create a derived class (or child class) from a superclass, sometimes we have to call the constructor of the base class along with the constructor of the derived class. Unlike Java, there is no reference variable for the superclass. If the constructor is non-parameterized, then it will be called automatically with the derived class, otherwise, we have to put the superclass constructor in the initializer list of the derived class. Constructor Without Arguments It is a default constructor where no argument is passed to it. Here, we create a ...

Read More

What do you mean by a dynamic initialization of variables?

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 01-Jul-2025 9K+ Views

Dynamic initialization of object refers to initializing the objects at run time i.e., the initial value of an object is to be provided during runtime. Dynamic initialization can be achieved using constructors and passing parameters values to the constructors. This type of initialization is required to initialize the class variables during runtime. Why do we need the dynamic initialization? Dynamic initialization of objects is useful because It utilizes memory efficiently. Various initialization formats can be provided using overloaded constructors. It has the flexibility of using different formats ...

Read More

Read integers from a text file with C++ ifstream

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 01-Jul-2025 8K+ Views

In C++, we can read the integer values from text files using the ifstream class that allows the user to perform input operations from the files. Here, we have filename (tp.txt) that used in the program and store some integers value. 21 61 24 05 50 11 12 21 66 55 Example to Read Integers from a Text File In this example, we created one text file to save the integers values and then access those value using file handling operation. #include #include using namespace std; int main() { // Define the maximum ...

Read More

How can I get a file\\\'s size in C++?

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 01-Jul-2025 15K+ Views

In C++, the file size determines the total number of bytes. To get the file size, we can take reference of the fstream header which contains various functions such as in_file(), seekg(), and tellg(). Example Input: The file name is tp.txt content- "Hello Tutorialspoint" Output: Size of the file is 22 bytes Example Input: The file name is testfile.txt content- "Hello Tutorialspoint" Output: File size is 27 bytes Now, we will demonstrate the C++ programs of the above two examples using file handling. Getting File Size in C++ The short form of fstream header is file stream which ...

Read More
Showing 1–10 of 185 articles
« Prev 1 2 3 4 5 19 Next »
Advertisements