水仙花数
获取个位 153%10=3
获取十位 153/10=15 15%10=5
获取百位 153/100
#include <iostream>
#include <string>
#include<ctime>
using namespace std;
int main()
{
int num = 100;
do
{
int a, b, c = 0;
a = num % 10;
b = num / 10 % 10;
c = num / 100;
if (a* a* a + b * b * b + c * c * c == num)
{
cout << num << endl;
}
num++;
} while (num < 1000);
system("pause");
return 0;
}