An introduction to TinyXML2 parser using C++ ( Read – Insert)

C++, without any doubt, is the most popular programming language that can be found literally everywhere. since its birthdate in 1985, C++ has been the base language for learners, engineers, scientists, and researchers. In some instances, an application written in C++ may require saving and retrieve data that is located in an XML file. There... » read more

How to remove duplicates from an array of integers in C++?

The following piece of code traverses the list of integers, removes duplicate numbers, if any, and returns the remaining list. #include <iostream> #include <vector> #include <algorithm> void removeDuplicates(std::vector<int> &list) { auto end = list.end(); for (auto i = list.begin(); i != end; ++i) { end = std::remove(i + 1, end, *i); } list.erase(end, list.end()); }... » read more

How to reverse a signed integer value in C++?

Below is an easy function to reserve a signed integer in C++ #include <iostream> #include <string> int reverse(int x) { int rev = 0; int max = 2147483647; int min = -2147483648; while (x != 0) { int pop = x % 10; x /= 10; if (rev > max / 10 || (rev ==... » read more