#include <iostream> using namespace std; int main() { int a; while (cin >> a) { // 注意 while 处理多个 case int shiwei; shiwei = a / 10 %10; if (shiwei < 0){ shiwei=-shiwei; } cout << shiwei << endl; } } // 64 位输出请用 printf("%lld")
思路就是除以10之后就变成求个位了
#include <iostream> using namespace std; int main() { int a; while (cin >> a) { // 注意 while 处理多个 case int shiwei; shiwei = a / 10 %10; if (shiwei < 0){ shiwei=-shiwei; } cout << shiwei << endl; } } // 64 位输出请用 printf("%lld")
思路就是除以10之后就变成求个位了