// wanmeilifang.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
采用的是枚举法,四重循环
int main()
{
int N;
cout << "请输入一个小于365的数:";
if (cin >> N)
cout << endl;
for (int a = 2; a <= N; ++a)
for (int b = 2; b < a; ++b)
for (int c = b; c < a; ++c)
for (int d = c; d < a; ++d)
if (a*a*a == b*b*b + c*c*c + d*d*d)
{
cout << "cube=" << a << "," << "(" << b << "," << c << "," << d << ")" << endl;
}
system("pause");
return 0;
}