Run ID:114098
提交时间:2025-03-20 21:42:32
#include <iostream> int main() { int a; std::cout << "请输入一个四位数: "; std::cin >> a; if (a >= 1000 && a <= 9999) { int thousands = a / 1000; int hundreds = (a % 1000) / 100; int tens = (a % 100) / 10; int units = a % 10; int newNumber = units * 1000 + thousands * 100 + hundreds * 10 + tens; std::cout << "变换后的数字是: " << newNumber << std::endl; } else { std::cout << "输入的不是四位数,请重新运行程序并输入正确的数字。" << std::endl; } return 0; }