my char doesnt change to what i want

Im trying to make a hexadecimal to decimal converter as a test for myself, it all works well until i try assign a number to it, when i do it turns into a smiley face... i just want it to

1
2
3
4
5
6
7
8
9
10
 #include <iostream>
int main()
{
    char y;
    std::cin >> y;//i will enter 'a'
     y=5;//it should become 5 there but it doesnt
    std::cout << y << std::endl;
    return 0;

}
closed account (E0p9LyTq)
You are assigning a char a numeric 5, not a character 5. y=5; should be y='5';.
OHHH thank you makes sense
Topic archived. No new replies allowed.