Advertisement
mgostih

Simple Ascii Graphics

Aug 4th, 2016
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <bitset>
  3.  
  4.  
  5. std::string GetRow(char ByteTemplate, char empty, char full){
  6.     std::string Binary = std::bitset<7>(ByteTemplate).to_string();
  7.     std::string Row;
  8.     for (int i = 0; i < 7; i++){
  9.         if (Binary[i] - '0'){
  10.             Row += full;
  11.         }
  12.         else{
  13.             Row += empty;
  14.         }
  15.         Row += ' ';
  16.     }
  17.     Row[Row.size() - 1] = '\n';
  18.     return Row;
  19. }
  20. int main(){
  21.     std::cout << GetRow(0, '0', '1');
  22.     for (int i = 0; i < 16; i++){
  23.         std::cout<<GetRow(8, '0', '1');
  24.     }
  25.     std::cout << GetRow(0, '0', '1');
  26.     system("PAUSE>NUL");
  27.  
  28.  
  29. }
  30. //mgostIH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement