my char doesnt change to what i want

Jul 23, 2015 at 5:28pm
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;

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