求一个100-999之间的水仙花数

水仙花数:num = 各个数的立方和

#include <iostream>

using namespace std;

int main() {

    int num = 100;
    do{
        int one = num % 10;
        int two = num /10 % 10;
        int three = num /100 ;
        if(one * one * one + two * two * two + three * three * three == num){
            cout<< num <<" ,是水仙花树"<< endl;
        }

        num ++;
    }while (num < 1000);


    return 0;
}
原文地址:https://www.cnblogs.com/dongma/p/13806061.html