Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. void main()
  7. {
  8. setlocale (LC_ALL, "Russian");
  9. char text[1000]="";
  10. char text2[1000]="";
  11. char text3[1000]="";
  12. int x, H, W;
  13.  
  14. cout << "Текст: "; cin >> text;
  15. cin >> x; cin >> H; cin >> W;
  16.  
  17. char result_1[1000]="";
  18. for (int i=0; i<x*H*W; i++)
  19. result_1[((i/x)%W*H+(i/x)/W)*x+(i%x)]=(i<strlen(text)) ? text[i] : '_';
  20. cout << "Шифр #2: " << result_1 << "\n";
  21.  
  22. cin >> text3;
  23. char result_2[1000]="";
  24. for (int i=0; i<x*H*W; i++)
  25. result_2[((i/x)%H*W+(i/x)/H)*x+(i%x)]=(text3[i]=='_') ? ' ' : text3[i];
  26. cout << "Расшифровка #2: " << result_2 << "\n";
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement