Mourning the loss of our friend, WhitPhil.
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Software Development
Tag Cloud
access audio black screen blue screen boot bsod connection crash dell desktop driver drivers dvd email error excel excel 2003 firefox hard drive hardware hdmi hijackthis internet keyboard laptop malware monitor motherboard network networking outlook problem recovery router screen slow sound spyware tdlwsp.dll trojan upgrade video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Recursion in C++

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

 
Thread Tools
chart2006's Avatar
chart2006 has a Photo Album
Member with 82 posts.
 
Join Date: Aug 2005
Experience: Beginner
30-Oct-2009, 12:32 PM #1
Recursion in C++
there are multiple functions I'm wanting to call within one another in the same else if statement. Is this possible? If so how would I do it? Here is the portion of code for that section. As you can see my three functions are 'bin2dec' 'GetInt' and 'dec2hex.'

cout << "Input binary number:";
cin >> bin;
bin2 = bin2dec(bin);
num2 = GetInt(bin2);
cout << "\nDecimal equivalant is:"<<bin2dec(bin)<< "\nHexadecimal equivelant is:"<<dec2hex(num2)<<endl;

instead of writing an entire function for binary to hex I'm taking my binary to dec then dec to hex. I already have the dec to hex function for another output. Anyway when displayed it gives me the correct dec value but only give me 0's for the hex values. It's not the functions themselves because they are used elsewhere and work fine. Can anyone tell me what I'm doing wrong with it?
__________________
Vista 64-bit, Phenom II X4 940-3.8GHz, 6GB DDR2 PC8500, GTX 280 OCX, 3.5TB HDDs, Antec PSU (550W + 650W), DCLLCD 24', CoolIT Eliminator EL-1000
pvc_'s Avatar
Computer Specs
Senior Member with 387 posts.
 
Join Date: Feb 2008
Location: Orlando, FL
Experience: Computer Scientist
01-Nov-2009, 08:36 AM #2
It could be the formating of the cout function. Try using printf.
Reply Bookmark and Share

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 08:36 PM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.