How do you implement a binary number to convert into an equivalent decimal number using stack in C++.I am having a headache here.I have been thinking the past 2 days but without much knowledge in C++ i am partially dead. Tried reading books but still can't figure it out and time is running short on me.Please advice and help.Thanks in advance
Recommended Answers
Jump to PostThere are essentially two steps to the problem, given
void foo ( int num );1. do something with num % 2
2. call foo ( num / 2 );Changing the order of those two steps changes what happens - feel free to experiment.
Oh, and …
Jump to PostThere are essentially two steps to the problem, given
void foo ( int num );1. do something with num % 2
2. call foo ( num / 2 );Changing the order of those two steps changes what happens - feel free to experiment.
Oh, …
Jump to Postyou mean my program is already using stack?actually i know nothing about stack and i just started c++ a week ago. i am still learning now.
huh?
You started programming a week ago and you're already learning data structures? Hmm, you must have an incompetent teacher like myself. LOL.
…
Jump to Post>>is there a specific function to push and pop
No. It depends on the implementation. If you are going to implement your own stack then you get to decide how do set things up. If you are using a third party implementation then you use the functions provided without …
Jump to PostThe easiest answer is that you will probably find any number of stack implementations by searching the web. However, you will learn more by doing it yourself.
The two versions of implementing a stack that I'm most familiar with use either an array or a list as the underlying …
All 44 Replies
Kellaw
0
Newbie Poster
Salem
5,138
Posting Sage
iamthwee
1,547
Banned
Featured Poster
Kellaw
0
Newbie Poster
iamthwee
1,547
Banned
Featured Poster
Kellaw
0
Newbie Poster
Lerner
582
Nearly a Posting Maven
Kellaw
0
Newbie Poster
Lerner
582
Nearly a Posting Maven
Kellaw
0
Newbie Poster
iamthwee
1,547
Banned
Featured Poster
dreamreaver
0
Newbie Poster
iamthwee
1,547
Banned
Featured Poster
Kellaw
0
Newbie Poster
Lerner
582
Nearly a Posting Maven
Kellaw
0
Newbie Poster
iamthwee
1,547
Banned
Featured Poster
Kellaw
0
Newbie Poster
iamthwee
1,547
Banned
Featured Poster
Kellaw
0
Newbie Poster
Kellaw
0
Newbie Poster
iamthwee
1,547
Banned
Featured Poster
iamthwee
1,547
Banned
Featured Poster
Kellaw
0
Newbie Poster
Lerner
582
Nearly a Posting Maven
Lerner
582
Nearly a Posting Maven
Kellaw
0
Newbie Poster
Kellaw
0
Newbie Poster
iamthwee
1,547
Banned
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.