What is a dangling else problem? It's presented below - what will print this program?
#include <iostream>
int main()
{
bool a = true;
bool b = false;
if(a)
if (b)
std::cout << "foo" << std::endl;
else
std::cout << "bar" <<...
Tiny and cheap lab generator
in electronic engineering / with 2 comments /
Function generator is a rely useful tool in the lab, a simple version can be build at home, there's a lot of examples on the Internet, some are much more complex and powerful, but this one is intended to be really simple and cheap. It can be also built-in...
More readable way of casting primitive types in C++
in C and C plus plus, programming, smart code / with No comments /
How to cast a variable of one primitive type to another? Usually people use static_cast operator, but it can be done in other, more readable way.
Below example demonstrate the problem, and two solutions:
char var1 = 3;
char var2 = 5;
// first way
int result1 = static_cast<int>(var1 + var2);
//...
A trip with Geiger Counter on the Śnieżka mountain
in C and C plus plus, programming, radioactivity / with 1 comment /
During the Second World War Nazis established a uranium mine in Krkonoše mountains. Extracted ore was used in a research facility in Oranienburg. After the war, the mine was in polish borders, but Poland was then a puppy country of the USSR, so the ore...
Subscribe to:
Posts (Atom)