请问有更好的方法吗??
#include<iostream> //header fileusing namespace std;
int main()
{
int num,num1,num2,num3,num4,num5,num6;
cout<<"Please enter your 7 digit student number (example:1234567):";
num=getchar();
num1=getchar();
num2=getchar();
num3=getchar();
num4=getchar();
num5=getchar();
num6=getchar();
cout<<"That number reversed is : ";
putchar(num6);
putchar(num5);
putchar(num4);
putchar(num3);
putchar(num2);
putchar(num1);
putchar(num);
return 0;
}