
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

2K+ Views
When we call some functions, the call stack stores the address, and after returning, it pops the address to resume work. What is Stack Unwinding Stack unwinding refers to the process of removing function call frames from the function call stack during runtime, wherein local objects are destroyed in the reverse order of their construction. Why Stack Unwinding Occurs? Stack unwinding occurs when an exception occurs in a function and is not handled immediately in that function. The program control goes back through each function step by step, cleaning up any temporary resources used by each function. How Unwinding Works? ... Read More

153 Views
In this article, we will explore what happens when we concatenate two string literals in C++. There are two important points to remember when concatenating strings in C++. Concatenation is another property of the string and string literals: let's see the following two properties below: If x + y is the expression of string concatenation, where x and y are both strings. Then the result of this expression will be a copy of the characters of string x followed by the characters of string y. Either x or y can be ... Read More

896 Views
In this article, we will see how to convert a Decimal to a Hexadecimal string and versa in C++. For this conversion, we are using the string stream feature of C++. You can use StringStreams for formatting, parsing, converting a string into numeric values, and more. The Hex is an I/O manipulator. It takes a reference to an I/O stream as a parameter and returns a reference to the string after manipulating it. Implementation of converting Decimal to Hexadecimal In the following example, we will see how to convert decimal numbers or hexadecimal numbers in C++. #include #include ... Read More

3K+ Views
In this article we will see what are the Stringize operator and Token Pasting operator in C. The stringize operator (#) and the token pasting operator (##) are preprocessor operators used within macros for text manipulation. It sends commands to compiler to convert a token into string. Stringize Operator (#) The stringize operator (#) is a preprocessor operator that converts the micros parameter into a string literal. The preprocessor encloses the actual argument passed to the macro in double quotes, effectively convert it into a string. Syntax Following is the syntax of Stringize Operator: #define MACRO_NAME(arg) #arg ExampleIn ... Read More

654 Views
C provides libraries for string operations such as the string.h header file that contains a strlen() function, which counts the length of a string. Otherwise, a loop can be used to count the string length. There are also different ways to find the length of a string apart from the above two methods. So, basically, in this article, we will learn how to find the length of a string without string.h and loop in C. Find Length of a String Without string.h and Loop in C There are the following ways to find the string's length without using the string.h ... Read More

3K+ Views
std::string The std::string is a class of C++ Standard Library (STL) that represents a string (sequence of characters). It is used to handle strings with better memory management, i.e., it provides dynamic memory management for strings and supports a rich set of in-built functions for string manipulation. Syntax Following is the syntax of string: string str = "tutorialspoint"; std::LPCWSTR The LPCWSTR stands for Long Pointer to Constant Wide STRing. It is a constant string of 16-bit Unicode characters, which may be null-terminated. It is the same as a string but with wide characters. Syntax Following is the syntax of ... Read More

4K+ Views
std::string The std::string is a class of C++ Standard Library (STL) that represents a string (sequence of characters). It is used to handle strings with better memory management, i.e., it provides dynamic memory management for strings and supports a rich set of in-built functions for string manipulation. Syntax Following is the syntax of string: string str = "tutorialspoint"; std::LPCSTR LPCSTR stands for Long Pointer to Constant String. It is a constant, null-terminated string of ANSI (narrow) characters (8-bit characters). In contrast to LPCWSTR, which stores wide characters (Unicode/UTF-16), LPCSTR is used in Windows API functions to store regular char-based ... Read More

365 Views
A histogram is a visual representation of the distribution of quantitively data. You are given a histogram represented by an array arr [], Where each of the array's elements represents the height of the bar in the histogram. All the bars have unit width, i.e., 1 unit. Your task is to determine the largest rectangle area possible in a given histogram, where the largest rectangle is made up of several consecutive bars with heights displayed in an array. Input / Output Scenario Let's understand the below input-output scenario with a diagram: Input: arr[] = [40, 10, 20, 50, 60, 30] ... Read More

177 Views
Here is a C++ Program to implement First Fit Decreasing for 1-D objects and M binsRequired functions and pseudocode:Begin function binPack() returns number of bins required. Initialize binC = 0 Initialize an array to store binVal. Place items one by one. function sort() to perform bubble sort in the descending order. EndExample Code#include using namespace std; void binPack(int *a, int s, int n) { int binC = 0; int binVal[n]; for (int i = 0; i < n; i++) binVal[i] = s; for (int i = 0; i < ... Read More

4K+ Views
This is a C++ Program to Implement the Edmonds-Karp algorithm to calculate maximum flow between source and sink vertex.Algorithm:Begin function edmondsKarp() : initiate flow as 0. If there is an augmenting path from source to sink, add the path to flow. Return flow. EndExample Code#include #include #include #include #include using namespace std; int c[10][10]; int flowPassed[10][10]; vector g[10]; int parList[10]; int currentPathC[10]; int bfs(int sNode, int eNode)//breadth first search { memset(parList, -1, sizeof(parList)); memset(currentPathC, 0, sizeof(currentPathC)); queue q;//declare queue vector q.push(sNode); parList[sNode] = -1;//initialize parlist’s ... Read More