fork(1) download
  1. #include <string>
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. string old;
  11. cout << "Введите двоичный код" << endl;
  12. cin >> old;
  13. for(int i = 0; i < old.size(); ++i)
  14. {
  15. cout << old[i];
  16. if (i%4 == 3) cout << " ";
  17. }
  18. }
  19.  
Success #stdin #stdout 0.01s 5436KB
stdin
010101010000101010101010000111111010101
stdout
Введите двоичный код
0101 0101 0000 1010 1010 1010 0001 1111 1010 101