| | |
Convert Decimal to hexadecimal number
Please support our C++ advertiser: Intel Parallel Studio Home
This code converts decimal number to hexadecimal number
I wrote it by Borland 5.02 .
Good Luck
I wrote it by Borland 5.02 .
Good Luck
//Decimal to hexadecimal number //programming by : Erfan Nasoori //Date of send : 2009/1/11 #include <iostream.h> void main() { int x,y,i; int d,n=1; int * r; char h[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; cout<<"Enter x : "; cin>>x; y=x; while(x >= 10) { x/=10; ++n; } r=new int[n]; for(i=0 ; y >= 16 ; ++i) { r[i]=y%16; y /= 16; } r[i++]=y; cout<<"16 base = "; for(i=(n-1) ; i>=0 ; --i) { cout<<h[r[i]]; } cin.get(); }
Similar Threads
- Code Snippet: hexadecimal to Decimal number (C++)
- convert Decimal to Hexadecimal system.. (C)
- Convert decimal to binary number? (Assembly)
- Convert decimal to binary number? (Assembly)
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy dll download dynamic encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library lines linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference return simple sort spoonfeeding stream string strings struct temperature template templates test text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets



