URGENT!!! Write a program that produces the binary equivalent of a non-negative integer input by the user.

Pages: 123
Smart but not at the moment.

He said to do a string s + 0 or 1 at certain lines but I don't really know what he means by that or what is supposed to do. Idk how that helps show the s in the end.
Here it is again: http://cpp.sh/76eai
Last edited on
I don't think he meant to literally put "string s + 0" in your code. I think he meant that you should add "0" or "1" to the string, based on whether the number is divisible by 2.

Do you know how to add a character to a string?
Umm I think so. So what does adding one or two do to help show s in the end?

http://cpp.sh/4442d so this is what I have rn
Do I need to do something like remainder=num % 2
or s=num % 2;?
I played around with this putting 0 and 1 but when I put zero it showed the first line then stopped
Last edited on
This is Due today I really just need to figure out how to finish it.
Do I need to move my Cout things at the end somewhere in the if or the else. and what else do I need to add?
Last edited on
It appears that you're spending your time asking people for the answers rather than trying to figure them out for yourself. Read the description of the algorithm again until you understand how it works. Then look at the code you have and try to understand how it implements the algorithm. If you do this, it will be clear what needs to added.

It's also possible that programming just isn't for you. Please don't take this as an insult. There are lots of people who just don't "get" programming. You may be one of them. Don't feel bad, I'm sure that there are plenty of things that you can do much better than a programmer like me.
Topic archived. No new replies allowed.
Pages: 123