Supposed your code (which you unfortunately don't show in your question) is something like
int main() {
int n = 4;
float n2 = 4;
char n = 4;
std::cout << n << std::endl;
std::cout << n1 << std::endl;
std::cout << n2 << std::endl;
}
You should acknowledge that char
values should be initialized using '4'
to get a printable character.
These can also be numbers, but you need to put the correct character encoding codes then, that are supported by your targets environment.
The most common encoding nowadays is ASCII, where the correct decimal equivalent for 4
is encoded as 52 as decimal number.
C++ provides different overloads of the std::ostream& operator<<(std::ostream&, type)
for all of the mentioned types like int
, float
and char
. Rendering the numerical types is already done automatically.
If you actually want to render the numerical value contained from char n2
, simply cast it.
My window is not in Korean, but I am using Korean Keyboard with U.S. like: ...
Your keyboard settings don't have any relevance here.