I'm converting numbers and am confused..My first if works fine..
If i type in A I get back : 10
if i type in B I get back : 11
if i type in C i get back: 12
etc etc..
But If i type in 0-9 i am getting weird numbers, like i type in 5 and get back 1?
And I need to get back 0 the digit.
so I need to be able to put in a 1 and get back 1/
put in a 2 and get back 2.
etc etc
#include <iostream>
usingnamespace std;
int main(){
char input = ' ';
cout << "Enter your number: "; cin >> input;
int num = 0;
num = input; //If the user types in A, then num will now have the value of 65 in decimal
if(input >= 'A' && input <= 'J')
{
num = input - 'A' + 10;
cout << num << endl;
}
elseif(input >= '0' && input <= '9')
{
input = num + 'A' - 10;
cout << input << endl;
}
else
;
system("pause");
}