高手帮我做c++编程啊!

来源:百度知道 编辑:UC知道 时间:2024/06/18 03:33:30
打印出所有的“水仙花数”,所谓“水仙花数”是指一个三位数,其个位数字立方和等于该数本身。
例如:153是一个“水仙花数”,因为153=1的3次方+5的3次方+3的3次方

#include<iostream>
using namespace std;
void main()
{
int a=100;
int q,w,e;
for(a;a<1000;++a)
{
q=a/100;
w=(a-q*100)/10;
e=(a-q*100-w*10);
if(a==q*q*q+w*w*w+e*e*e)
cout<<a<<"是水仙花数"<<endl;}
}

我目前只会VB