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

1K+ Views
The Euler path is a path using which we can visit every edge exactly once in a graph. The same vertex can be used for multiple times. The source and destination nodes in the Euler path are different. If the source and destination node become the same, then the Eulerian path is also an Eulerian cycle. In this article, our task is to check if there exists an Eulerian path in the given undirected graph. Example of Eulerian Path The figure below displays an undirected graph and its respective adjacency matrix. As we can see there exists an Eulerian ... Read More

541 Views
The Euler path is a path by which we visit every edge exactly once while using the same vertices multiple times. When the starting and ending vertex of the Euler path is the same node (i.e., if a path starts from node 'A' and ends on node 'A'), it is also known as the Eulerian cycle. In this article, our task is to check if the Eulerian cycle exists in the given undirected graph or not. Example of Eulerian Cycle The figure below displays an undirected graph and its respective adjacency matrix. As we can see there exists ... Read More

433 Views
Here we will see how to get the sorted sequence using B-Tree. The B-tree is n-ary tree. To get the sorted sequences, we can create a B-tree, then add the numbers into it. Here the B-tree can hold maximum 5 nodes. If number of nodes increases, split the node and form new level. As the nodes are holding few number of elements like 5 (at most), we are using Bubble sorting techniques to sort them. as the number of elements is very low, then it will not affect too much on its performance.After traversing the tree, we will get all ... Read More

128 Views
Here we will see the fesetround() and fegetround() method in C++. These methods can be found in the cfenv library.The fesetround() method is used to set the specified floating point rounding direction to the current rounding direction. This is used with rint(), nearbyint() and some other rounding functions in C++.The syntax is like below −int fesetround(int round);The round can be among these FE_TONEAREST, FE_DOWNWARD, FE_UPWARD etc. This function returns 0 when rounding direction is successfully applied to the required manner.Example#include #include #include using namespace std; main() { double x = 4.7, ans; fesetround(FE_TONEAREST); //round to ... Read More

571 Views
In C++, we can use the function overloading techniques. But if some base class has one method in overloaded form (different function signature with the same name), and the derived class redefines one of the function which is present inside the base, then all of the overloaded version of that function will be hidden from the derived class.Let us see one example to get the clear idea.Example#include using namespace std; class MyBaseClass { public: void my_function() { cout

2K+ Views
In C++, the friendship is not inherited. It means that, if one parent class has some friend functions, then the child class will not get them as friend.In this example it will generate an error because the display() function is friend of MyBaseClass but not the friend of MyDerivedClass. The display() can access the private member of MyBaseClass.Example#include using namespace std; class MyBaseClass { protected: int x; public: MyBaseClass() { x = 20; } friend void display(); }; class MyDerivedClass : public MyBaseClass { private: int y; public: MyDerivedClass() { x = 40; } }; void display() { MyDerivedClass derived; cout

285 Views
Here we will see how we can extend some namespace, and how the unnamed or anonymous name space can be used.Sometimes we can define one namespace. Then we can write the namespace again with the same definition. If the first one has some member, and second one has some other members, then the namespace is extended. We can use all of the members from that namespace.Example#include using namespace std; namespace my_namespace { int my_var = 10; } namespace my_namespace { //extending namespace int my_new_var = 40; } main() { cout

810 Views
In every C/C++ program, execution starts from the main() function. Defining multiple main() functions will result in a compilation error. Can main() be Overloaded in C++? No, we cannot overload the main() function in C++ because main() serves as the entry point of any C++ program and must follow a predefined prototype. While C++ does support function overloading (i.e., multiple functions with the same name but different parameters), this does not apply to the main() function. If you try to create multiple main() functions will result in a compilation error due to invalid overloading. The following are the only two ... Read More

632 Views
In C++, function overloading and const keyword are used for different purposes. Function overloading provides different ways to call a function with different parameter types that make the program more readable. While the const keyword provides the ways of declaration such as variable, member variable, function parameters, member function, and return type. What is Function Overloading? Function overloading is the process of defining multiple functions having the same name but different parameter lists. It is also known as compile-time polymorphism. Here, we have list of three points to describe function overloading in C++: The parameter ... Read More

1K+ Views
In C++, a private destructor is a destructor that is declared within a private access specifier, which means that the destructor cannot be accessed or called directly outside the class, which is useful for design patterns where the user wants to control how and when an object will destroy. Syntax Here is the following syntax for a private destructor, which is declared in the class like any other destructor, but with the private access specifier. class MyClass {private: // Private destructor ~MyClass() { }public: // Public constructor MyClass() { // Constructor code here }}; Here we will see what will ... Read More