Solved Input cin to a hexadecimal integer C++

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Alavon

Jr.Coder
Nobleman
Mar 24, 2013
83
439
0
Hey guys, small issue!

Lets say i have got this:

C++:
int Address = 0x0234A230;
When i use this the program runs fine but if i want the user to input the Address the output would be 0.

C++:
int Adress;
cout << "Please enter a hexadecimal address (With 0x0): " << endl << endl;
cin >> Address;
cout << endl << endl << "The entered address: " << Adress << endl;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The output will be zero, adding the address to a string and converting it then also gives a 0.

Anyone got a solution for this?

Thanks, Elertan ;)
 

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
You don't change value of CIN, only COUT
C++:
cout << hex << nYourInteger << endl;
 
Last edited by a moderator:

kaz

Coder
Full Member
Nobleman
Apr 3, 2013
160
1,183
7
You have Address
and when you use cout you did Adress
 

Nether

The Angel Of Verdun
Meme Tier VIP
Dank Tier Donator
Dec 11, 2013
293
3,738
16
Hey guys, small issue!

Lets say i have got this:

C++:
int Address = 0x0234A230;
When i use this the program runs fine but if i want the user to input the Address the output would be 0.

C++:
int Adress;
cout << "Please enter a hexadecimal address (With 0x0): " << endl << endl;
cin >> Address;
cout << endl << endl << "The entered address: " << Adress << endl;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The output will be zero, adding the address to a string and converting it then also gives a 0.

Anyone got a solution for this?

Thanks, Elertan ;)
You had Adress & Address (difference being spelling - don't know if this was a forum typo or C&P from your source), and as said before you need to declare output as hex [use this output {hex} locally, never globally as all your outputs will be in hex]
You can also use this on cin(input) as far as i know so you don't need to input 0x0.... etc just the address.

C++:
DWORD Address = 0; //Initialize Variable
cout << "Enter Address: "; //Don't End Line - Cleaner Formatting
cin >> hex >> Address; //Input Hex On Same Line As (Enter Address: _ )
cout << "\nThe Entered Address Is: " << hex << Address; //Output the result on a new line (/n)
 
Last edited:

Alavon

Jr.Coder
Nobleman
Mar 24, 2013
83
439
0
You had Adress & Address (difference being spelling - don't know if this was a forum typo or C&P from your source), and as said before you need to declare output as hex [use this output {hex} locally, never globally as all your outputs will be in hex]
You can also use this on cin(input) as far as i know so you don't need to input 0x0.... etc just the address.

C++:
DWORD Address = 0; //Initialize Variable
cout << "Enter Address: "; //Don't End Line - Cleaner Formatting
cin >> hex >> Address; //Input Hex On Same Line As (Enter Address: _ )
cout << "\nThe Entered Address Is: " << hex << Address; //Output the result on a new line (/n)
You and Liduen this is what i was searching for, thx for replying to my thread! And yes the second Adress was my spelling :)
 
Last edited:
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods