There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Tag Cloud
access acer asus bios bsod computer crash dns driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop lcd malware memory missing monitor motherboard network operating system printer problem ram registry router slow software sound toshiba trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless xbox
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Recursion in C++

Reply  
Thread Tools
chart2006's Avatar
chart2006 has a Photo Album
Member with 100 posts.
 
Join Date: Aug 2005
Experience: Beginner
30-Oct-2009, 01: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?
__________________
Win7 64-bit, Phenom II X4 965, M4A79XTD-EVO Mobo, 4GB DDR3 1600, GTX 280 OCX, 320GBx4 HDDs, Antec PSU (550W + 650W), DCLLCD 24',
pvc_'s Avatar
Computer Specs
Member with 456 posts.
 
Join Date: Feb 2008
Location: Tampa, FL
Experience: Computer Scientist
01-Nov-2009, 09:36 AM #2
It could be the formating of the cout function. Try using printf.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




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



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:04 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.