by Suf | Aug 20, 2022 | C++, Programming, Tips
You can sort a vector in C++ using the std::sort function. This tutorial will go through how to sort a vector in ascending and descending order. Table of contentsSort a Vector using std::sortSort a Vector in Descending Order using std::sortSummary Sort a Vector using...
by Suf | Mar 21, 2022 | C++, Programming, Tips
This tutorial will go through how to find an element in a C++ vector and how to count the number of occurrences of an element with the help of code examples. Table of contentsA Brief Introduction on Vectors in C++Find Element in C++ Vector Using std::find()Return...
by Suf | Mar 5, 2022 | C++, DSA, Programming, Tips
Bubble sort is a popular sorting algorithm that compares the adjacent elements in a list and swaps them if they are not in the specified order. This tutorial will explain how to implement the bubble sort algorithm in C++ using code examples. Got some C++ code? Test it...
by Suf | Mar 5, 2022 | C++, Programming, Tips
This tutorial will go through how to convert a String to a float/double and vice versa. Table of contentsWhy Convert Strings to Float/Double?Strings in C++Convert String to Float in C++Convert String to Double in C++Convert Char Array to Float in C++Convert Char Array...
by Suf | Mar 4, 2022 | C++, Programming, Tips
A C++ string variable contains a collection of characters surrounded by double-quotes. There are two types of strings used in C++. C-strings, which are arrays of type char terminated by the null character \0.Strings that are objects of the Standard C++ Library string...
by Suf | Mar 4, 2022 | C++, DSA, Programming, Tips
In mathematics, the Fibonacci sequence is a sequence of numbers where each number is the sum of the two preceding numbers. For example: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 65, .. The sequence starts with 0 and 1, and we find the following number by summing the two...