Advertisement
_eremec_

Untitled

Dec 17th, 2017
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. std::string bitshiftright(std::string s) {
  2.     std::string res;
  3.     res = s[s.size()-1] + s.substr(0, s.size()-1);
  4.     std::cout << res << std::endl;
  5.     return res;
  6. }
  7.  
  8. int main() {
  9.     std::string s = "101001";
  10.     for (int i = 0; i<4; i++)
  11.         s = bitshiftright(s);
  12.     std::cout << s << std::endl;
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement