In this post we will write a couple functions to generate Fibonacci Numbers using the C++ programming language and the Visual Studio 2022 IDE, on a Windows 11 computer.
The motivation came from the on-line course C++20 Fundamentals by Paul J. Deitel, included in the O’Reilly Learning Platform offered by the Association for Computing Machinery.
C++20 for Programmers
by Paul Deitel and Harvey Deitel
Release Date: March 2022
Publisher: Pearson Education
Length: 1008 Pages
I have preordered the new book associated with the course on Amazon. Hopefully it should arrive next month. Continue reading “Fibonacci Numbers in C++”
In the past couple days I have been trying to get up at 06:00 AM instead of 05:00 AM. It is not working yet. Today I woke up around 04:30 AM, checked the time in my phone and decided to get up. Read a few articles of which two called my attention the most.
In Israel, Intel’s Mobileye has been testing an autonomous car that makes use of 12 cameras. Their software has ability to connect to RADAR and LIDAR but they have been driving the car in the city of Jerusalem. The video shown at CES show in Las Vegas looks pretty good. I agree with Elon Musk’s idea that an autonomous car should not require LIDAR. That said how many cameras and their position would be critical for success. I believe most humans only use their two eyes (one stereo camera) to drive vehicles. Of course humans have a very powerful computer which at this time we know little about how it works. Given time, I believe autonomous cars will use a limited set of cameras and newer and more powerful algorithms to allow them drive in most traffic and road conditions. Continue reading “Promise and Async in C++”
It is Saturday morning. Last week my wife was going to have over two of his brothers and spouses but she was not feeling well so lunch was postponed for today. After breakfast I made the dough for the spinach scacciata. It is resting in a bowl. After my second and last 2-hour block I will check out the dough.
We are missing fresh mushrooms for the chicken Marsala. My wife and I will be heading out to Trader Joe’s to pick up some last minute items we need for lunch and the upcoming week. Continue reading “Threads and Templates C++”
This week seems to be flying by. It is already Wednesday.
On my last post I mentioned that I get up around 05:00 AM every day of the week. I prepare and have breakfast, shower and get dressed, and go down to work around 06:00 AM. By the time I go to sleep around 07:30 PM, I am pretty tiered.
So what happens if something comes up around 05:00 PM CST at work? The company I work for is in California. That implies that it is relatively early in the afternoon at 03:00 PM PST. If urgent I will take a look and then address it on the next day. This is because at 05:00 PM CST I am fried. Since I wake up at 05:00 AM CDT, which is considerably early on the west coast (03:00 AM PST), I have plenty of time (about 5 hours) to get things done before people starts arriving around 09:00 AM PST. Continue reading “Creating Threads in C++”
If you have watched Red with Bruce Willis you may recall the opening scene. Frank Moses (Bruce Willis) is a retired CIA operative and he is sleeping in his bed. On the night stand next to him there is a clock. The clock is ticking down to 06:00 AM. Just as the clock reaches 06:00 AM, without the need of an alarm, Frank Moses wakes up and calmly walks down to the kitchen to get breakfast. Obviously Frank Moses is a very disciplined and a morning person. Continue reading “Tidbits – Streams in C++”
It is the last Wednesday of January and the Twin Cities of Minneapolis and ST. Paul have been experiencing very cold weather. It is being referred to as a polar vortex. Yesterday in the evening news the weatherman mentioned that our temperature was lower than in the South Pole. One way or another, the thermometer currently reads -29F. We expect even lower temperatures tomorrow reaching -35F. Hopefully the forecast will be amended today. Continue reading “C++ Tidbits – Exceptions”
What is generic programming? In a nutshell is a mechanism that allows the programmer to delay the data type used in a class / method to run time. If my vague description is not enough you could check here.
The main practical reason for generic programming is to avoid duplication. For example one may have a method or class that would need to be duplicated when using different data types. That grows the code base and may be prone to mistakes after copying and editing. Continue reading “C++ Tidbits – Generic Programming”
Good morning. It is a relatively cold Saturday in the Twin Cities. For some reason, this winter season has been warmer than usual with very little snow coverage. For example, today the high temperature will be around the freezing point. Some people (like me) like it while others hate it. There is no way to please everyone at once.
In an attempt to review in a systematic way some features of C++ I will be experimenting with polymorphism. In programming languages and type theory, polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types. To read more about it you may refer here.
Continue reading “C++ Tidbits – Polymorphism”
I am about to complete a course on Neural Networks and Deep Learning. I am amazed at how one gets absorbed into the subject and language (in this case Python). Lately when I am working with C, C++, Java or Python I occasionally use a syntax from a different language.
In this post I will be covering / reviewing Inheritance using C++. Many years ago when I wanted to review C I would pull from my bookshelf the book “C Programming Language” by Brian Kernighan and Dennis Ritchie. During the years I have owned several copies. A few minutes ago I tried to locate my latest copy, but it seems that it grew legs and walked away. For C++ I have … (I guess I have also misplaced it) a book by Bjarne Stroustrup. Given the fact that I want a quick refresher, decided to go over an Advanced C++ Programming course by Mike McMillan. For this post (and a few more that I will write in the next few days) I am using this course as a guide and will be coding C++ on Visual Studio 2017 from Microsoft. Continue reading “C++ Tidbits – Inheritance”
While programming in most (never say all) programming languages and platforms one often runs into the need to swap the values of two variables. The following code in Java illustrates a first attempt to swap two integers: Continue reading “Swap Values”