Hello, this code reverses a string.
Is it possible to manipulate it to reverse an integer instead ofa string? like to type in some numbers 123 and their reverse willbe 321.
Thanks!
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
int main(){
string str;
cout << “Enter a string: “;
getline(cin, str);
cout << “The string you entered in reverse order is: “;
for (int i = str.size()-1; i>=0; i–){
cout << str[i];
}
return 0;
}
Expert Answer
An answer will be send to you shortly. . . . .