求整数上各个位的数普通解法#include<iostream>using namespace std;int main(){ int num=234; while(num!=0){ cout<<num%10<<" "; num/=10; } return 0;} STL#include<iostream>using namespace std;int main(){ int num=234; string str=to_string(num); for(int i=0; i<str.size(); i++) cout<<str[i]<<" "; return 0;}