/****************************************************************************** * This program performs a math trick. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ #undef NDEBUG #include #include #include #include using namespace std; int main(int argc, char **argv) { srand(time(0)); int value = int(100 * (rand()/(RAND_MAX + 1.0))); int const ORIGINAL_VALUE = value; cout << "Value: " << value << endl; value *= 2; cout << "Double Value: " << value << endl; value += 10; cout << "Now add 10: " << value << endl; value /= 2; cout << "Cut in half: " << value << endl; value -= ORIGINAL_VALUE; cout << "Subtract Original Value: " << value << endl; cout << "Answer above should be 5" << endl; return 0; }