Monthly Archives: April 2023

Exploring Different Ways to Generate Random Numbers in C++: Coroutines and Concurrency

C++ is a versatile and powerful programming language that offers a variety of ways to solve problems. In the more advanced chapters of our book, Learning C++, we explore two different approaches to generating random numbers using C++20 coroutines and … Continue reading

Posted in Uncategorized | Leave a comment

Ranges in C++

Our book, Learning C++, has aWhen ranges are used, it makes coding easier and simper to develop and to understand, even though any code that uses range, can be also coded with an old style for..loop. Here is an example: … Continue reading

Posted in Uncategorized | Leave a comment

Why do we need modules

I have been using C++ since 1996. Yes, C++ is an old language but I always found it the best language to u to achieve any goal, including goals that are typically associated with other languages. I use C++ for … Continue reading

Posted in Code Snippets | Tagged , , , , , , , , | Leave a comment

Handling Exceptions

An important part of the book Learning C++  exception handling, and especially exception handling in C++ 20. Here is an example: #include <strexcept> #include <iostream> class MyException : public std::runtime_error { public: MyException(const char* message) : std::runtime_error(message) {} /* a … Continue reading

Posted in Code Snippets | Leave a comment

Capitals

One of the code samples in my book Learning C++  is Capitals. The purpose of the code was to explain key terms in the C++ 20 Standard Library, along with a small twist. The program tells you the capital of … Continue reading

Posted in Code Snippets | Leave a comment