Answer :
Answer:
#include <bits/stdc++.h>
#include <string>
using namespace std;
string IntegerToReverseBinary(int integerValue)
{
string result;
while(integerValue > 0) {
result += to_string(integerValue % 2);
integerValue /= 2;
}
return result;
}
string ReverseString(string userString)
{
reverse(userString.begin(), userString.end());
return userString;
}
int main() {
string reverseBinary = IntegerToReverseBinary(123);
string binary = ReverseString(reverseBinary);
cout << binary << endl;
return 0;
}
Explanation:
The string reverser uses a standard STL function. Of course you could always write your own, but typically relying on libraries is safer.