reversed number

closed account (ozyMoG1T)
Write your question here.


I tried to make the reversed number work.
Would someone please help me?

Thank you.
Last edited on
can you read the number as a string?

Then you can read the string like.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>

using namespace std;

int main() {
    string input;
    cout << "Please enter in the string you want to reverse:" << endl;
    cin >> input;
    input = string (input.rbegin (), input.rend ());
    cout << input;
    return 0;

}

closed account (E0p9LyTq)
reverse() doesn't do what you think it does. It works on containers, vector for instance.

http://www.cplusplus.com/reference/algorithm/reverse/

You need to create your own function to reverse the digits.
Last edited on
Topic archived. No new replies allowed.