try this
std::cout << char (65 + y);
per comment A
has numerical value of 65 thus 65 + y
. So above is the same as this:
std::cout << char ('A' + y);
Advice learn about casting in C++.
2
solved How can i write this expression in C++ using cout?