题解 | 反向输出一个四位数
反向输出一个四位数
https://www.nowcoder.com/practice/1f7c1d67446e4361bf4af67c08e0b8b0
#include <iostream>
using namespace std;
int main() {
char a[5], b[5];//cin末尾会加一个\0,所以数组大小应该为4+1
int i;
cin >> a;
for (i = 0; i < 4; i++)//数组内的数据从0开始到len-1
{
b[4-1-i] = a[i];
}
cout << b << endl;
return 0;
}

