Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com a program to convert a hexadecimal number into decimal number without using %x
 User Name Remember Me? Password

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 04-14-2013, 01:42 PM PM User | #1 fkbullet New to the CF scene   Join Date: Mar 2013 Posts: 3 Thanks: 0 Thanked 0 Times in 0 Posts a program to convert a hexadecimal number into decimal number without using %x i need a program to convert hexa decimal number to decimal number, a very simple program without using %x i have been trying to come up with a logic but couldnt do so, i wrote a program using string to take input scanf("%s", &hexDecimal); and then using if else conditons to do the maths like this if (hexaDecimal[i]=='0') { n=n-1; x=pow(16, n); decimalNumber[i]=0*x; } if (hexaDecimal[i]=='1') {, n=n-1; x=pow(16, n); decimalNumber[i]=1*x; } and continue using such if else condition from 0-9 and then A-F which represents number bigger than 9. but i get an overflow error, so i am stuck. please anyone who can write a simple program i will be very thankful. and yeah write it in c language, thanks a lot.
 04-14-2013, 01:56 PM PM User | #2 patryk Regular Coder     Join Date: Oct 2012 Location: /dev/couch Posts: 397 Thanks: 2 Thanked 64 Times in 64 Posts if you are using linux, then this is kinda re invnting a wheel. bash can do that Code: `echo \$((0x15a))` if you really want to use c for it, then you could use strtol() example here: http://www.cplusplus.com/reference/cstdlib/strtol/ __________________ ------------------------------------------------------------------------------- "Real Programmers can write assembly code in any language" - Larry Wall Last edited by patryk; 04-14-2013 at 02:01 PM..
 04-14-2013, 02:14 PM PM User | #3 fkbullet New to the CF scene   Join Date: Mar 2013 Posts: 3 Thanks: 0 Thanked 0 Times in 0 Posts Thanks i am using win8 and i am a beginner i just got admission in b.S.S.e in k.u so my teacher gave me this assignment to make aprogram to convert decimal binary hexadecimal and octal numbers, like we take a number from user and then convert it to the other systems, for example a user inputs a decimal number output will be its equivalent octal binary and hexadecimal number. i have written all the rest of the programs just two remaing hexadecimal to octal and hexadecimal to decimal, and yes ok i am reading the stuff on the link you gave me, if you could give me an example to implement it in my program that will be great.

 Bookmarks

 Tags clanguage, decimal, hexadecimal

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 02:33 PM.