Advertisement
mesmariusz

0to256_CRC32.cpp

Apr 1st, 2016
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <boost/crc.hpp>
  2. #include <boost/lexical_cast.hpp>
  3. #include <string>
  4. #include <iostream>
  5. #include <algorithm>
  6.  
  7. int main()
  8. {
  9. int licznik = 0;
  10. int suma = 0;
  11.  
  12. for ( licznik = 0; licznik <= 255; licznik++ )
  13. {
  14. suma = suma + licznik ;
  15. std::cout << "Wyraz: " << licznik << " --> Suma: " << suma << std::endl;
  16.  
  17. }
  18.  
  19. std::string str = boost::lexical_cast<std::string>(suma);
  20. boost::crc_32_type crc32;
  21. crc32 = std::for_each(str.begin(), str.end(), crc32);
  22. std::cout << "CRC32: " << crc32() << std::endl;
  23. system( "PAUSE" );
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement