Category: CPP

dec2bin function

This Function converts a decimal number into a 8bit long binary number.   std::string dec2bin(int dec) { int size = 8; bool bin[size]; int counter = size-1;   if (dec > 255) { return "Maximal 255"; }   // init the array for(int i = size; i >= 0; i–) { bin[i] = false; } [...]



sqrt() Function

This is the way sqrt works… Why do i have to code this by my own? const float EPSILON = 1e-6;   float working = val; float diff = 0; float keep = 0; float result = 0; int counter = 0;   do { result = (keep + working) / 2; //std::cout << "("<<keep<<"+"<<working<<") [...]