Home > front end >  Cant put a number into 2d array idk why
Cant put a number into 2d array idk why

Time:08-24

ok so im trying to print all characters in a computer. I did a nested loop to put all numbers into the 2d array and print them.

   int count = 0;
 char counte[4][5] = {{' ',' ',' ',' ',' '},
                       {' ',' ',' ',' ',' '},
                       {' ',' ',' ',' ',' '},
                       {' ',' ',' ',' ',' '}};


 for (int i = 0; i < 4; i  )
 {
    for (int j = 0; j < 5; j  )
    { 
        count  ;
        char thing =static_cast<char>(count);
      counte[i][j] = thing;
        
      
    }
    
 }
 for (int i = 0; i < 4; i  )
{
  
    cout << "\n";
    for (int j = 0; j < 5; j  )
    {
       cout  << counte[i][j];
    }
    
}

The problem is, when i try to print them it shows whitespaces!!!111! pls help i think the bug is in the first nested loop :c.

CodePudding user response:

The characters you are trying to print aren't visible characters. You can check what visible ones (starting from 33) at ASCII table

  • Related