Posts By: danyalzia


Read and write to file in C++

Many C++ developers find themselves in a place where they need to store information in an external file, which they can retrieve later to perform the operation based on the values. For instance, they have created a video game which has a high score system, wherein top 5 highest scores need to be saved in a file, as information saved in memory in real-time gets deleted once the program is turned off, so they would pursue a fast way to store their values in the external source.

Finding an element in a container (std::vector, std::list, etc.)

There is a time during the usage of a c++ class std::vector, std::list and others, when you need to find an element in the container. For instance, you want to create a collection of numbers (let’s suppose you have stored them in std::vector) and you have some function that checks for the given element in a container. Now you might need to find out whether some number exists in the std::vector class.