0

Before this part of code i have if else if statement to give the int value It is also randomized, but the only problem is with this part trying to make the outputint variable to become a character ascii value which output is declared as char right now my array shows the integer variables and not the respective ascii variables

output = static_cast<char> (outputint);
array[i][j] = output;
cout << array[i][j] << " ";
nick
  • 1
  • 1

1 Answers1

1

you just have to tell the compiler to print a char, like this:

cout << (char)array[i][j];

Or if you want to use C++ style casting:

cout << static_cast<char>(array[i][j]);

Nowhere Man
  • 475
  • 3
  • 9