Ok, this is an assignment question. I am not asking for someone to do my work. I have only been learning c++ for 7 weeks now.
So i have this code to work out the demical to binary but the code is backwards. Now i know I have to make it into a string but i am unsure on how to do that.
You can convert the remainder (which is an integer) into a character something like this:
char digit = rem + '0';
Then you could either concatenate that char on to the front of a std::string, or store each digit in consecutive locations of a character array, to give a null-terminated c-string.
The std::string approach is much easier to code, though the other approach may be more efficient.
Sure, but since you said it was an assignment, I didn't think it was appropriate to do all the work for you. So, which part specifically do you need help with?