write a compile and run a c++ program to reverse the digits of a positive integer number .use a do-while statement and continuously strip off and display the numbers units digit
please im a beginner i have no clue what to do
Have you tried turning it off and on again?
I recommend paying attention in class and doing whatever required reading there might be.
yes i did Easton multiple times. how would you go by writing the program ?
You COULD write it like this. I'll leave "explaining this code atrocity to the instructor" as an exercise for the OP.
std::string makePalindrome(std::string inStr)
sstr << inStr;
for (std::string::reverse_iterator rit = inStr.rbegin();
rit != inStr.rend();
sstr << (*rit);
std::cout << "Enter a number to reverse: ";
std::string newString = makePalindrome(userInput);
std::cout << newString.substr(userInput.size()) << "\n";
Last edited on
I would go about it by pasting the source code I should have made, and clearly explaining where the error in my source code is, and hoping that someone will help me after this post.