SHARE
TWEET

Untitled

a guest Sep 17th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void encode4PlusDigits(int value)
  2.       {
  3.             // slices an int number. eg.
  4.             // a[1,2,3] = a[1] = 2
  5.             int valueLen = to_string(value).length();
  6.             int sliced[valueLen];
  7.             for (int i = 0; i < valueLen; i++)
  8.             {
  9.                   sliced[i] = value % 10;
  10.                   value /= 10;
  11.                   this->data.push_back((sliced[i] * 3) % 10);
  12.             }
  13.             // reverse the vector because i sliced the array the wrong way around
  14.             reverse(this->data.begin(), this->data.end());
  15.       }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top