daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Feb 17th, 2017 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7. int atoi(const char* value,int base){
  8. stringstream strValue;
  9. strValue << value;
  10.  
  11. unsigned int intValue;
  12. strValue >> intValue;
  13.  
  14. int m1;
  15. int m2;
  16. int m3;
  17.  
  18. m1 = intValue % base;
  19. intValue/=base;
  20. m2 = intValue % base;
  21. intValue/=base;
  22. /*m3 = intValue % base;
  23. intValue/=base; */
  24. int szam = m1+m2*10+m3*100;
  25.  
  26. return szam;
  27. }
  28.  
  29. int main()
  30. {
  31.    int x = atoi("128",2);
  32.     cout << x << endl;
  33.  
  34.     return 0;
  35. }
RAW Paste Data
Top