So, I'm trying to make a basic C++ program that converts Base 10 -> Base 16
while(true){
int input;
cout << "Enter the base 10 number\n";
cin >> input;
cout << "The hex form of " << input << " is: ";
int decimal = input;
cout << hex << uppercase << decimal << "\n";
decimal = NULL;
input = NULL;
Sleep(3000);
}
And on the first run through it works. For example, if I enter 7331 I get:
The hex form of 7331 is 1CA3
But if I try it a second time (with the same input) I get:
The hex form of 1CA3 is 1CA3
I can try this with any integer input and it works fine for the first run through but after that it puts the base 16 number in twice.