#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
char* ret_number( char *number1, char *number2, int size );
int main()
{
char *number1 = (char*)malloc(1024);
char *number2 = (char*)malloc(1024);
int size;
cout << "Please input a number:";
cin >> number1;
size = strlen(number1);
number2 = ret_number(number1, number2, size);
cout << number2 << endl;
return 0;
}
char* ret_number( char *number1, char *number2, int size )
{
int i, j = size;
for( i = 0; i < size; i++, j-- )
{
number2[i] = number1[j-1];
}
return number2;
}
全站熱搜