# Thread: help storing and calculating hex values

1. ## help storing and calculating hex values

Code:
```#include <iostream.h>
int main()    //*this program basicly takes 2 numbers and adds them together
{  	          //*10 times (every time showing the result)
int a;       //*declaring var's
int x;
int z;
cout<<"enter offset to calculate:";   //asks for the first number
cin>>a;                              //stores first number in var "a"
cout<<"enter diffrence:";             //asks for the 2nd number
cin>>z;                               //stores 2nd number in var z
for(int x=0;x<10;x++)                 //a loop to make the code block loop 10 times
{
a=a+z;
cout<<"this is the result"<< a<<endl;
}
cin.get();                           //for some reason in order to make the program stay open
cin.get();                           //and not close right after its finished i had to use
return 0;                            // cin.get() twice :|
}```
this program takes 2 numbers and addts the 2nd number to the first 10 times, each time showing the result.
the problam is i want those 2 numbers to be hex values, if i try to write the value as hex the program crashes, can anyone point me to the right direction? (note: im a newb i love oyur site tutorials )

2. p.s
sorry for typos

3. thank you
you guys should include it in your tutorial so newbs like me could convert values :x

4. can someone PLEASE update the tutorials with the correct includes!

5. ## Something to keep in mind.

Any conversion is done only during input/output.

Everything is actually stored in binary. (Binary input/output is not as straight-forward as decimal/hex/octal.)

This means that once a number is in memory, it's "just a number". You can enter a hex number and a decimal number and then add them together without worrying about their different bases. You can then display the sum in decimal, octal, or hex.