I want to make a program that showes "Lagranges - statement":

Every even number can be made up by at least one combination

of four or less square numbers.

In the program you shall enter a specific, even number (haven't added that to the code yet). Then the program shall test all the possible combinations with 1,2,3 or 4 square numbers in (will be alot of them), and then subtract them with the specific number.

If it returns 0, then the combinations that went out should be outputted to the screen. (The screen outputs which I've used now is just for seeing if it works).

This is what I've got:

#include <iostream.h>

#include <stdlib.h>

int main()

{

int i;

int x;

int a;

int b;

int c;

int d;

int e;

int f;

for (i=0; i<=6; i++)

{

if(i==1){a=i*i;}

if(i==2){b=i*i;}

if(i==3){c=i*i;}

if(i==4){d=i*i;}

if(i==5){e=i*i;}

if(i==6){f=i*i;}

}

std::cout << a << " ";

for (i=0; i<=6; i++)

{

if (i==1)

{std::cout << a*2 << a*3 << a*4 << a*5 << a*6 << "\n";}

if (i==2)

{std::cout << a+(b*1) << a+(b*2) << a+(b*3) << a+(b*4) << a+(b*5) << a+(b*6) << "\n";}

if (i==3)

{std::cout << a+(c*1) << a+(c*2) << a+(c*3) << a+ (c*4) << a+(c*5) << a+(c*6) << "\n";}

if (i==4)

{std::cout << a+(d*1) << a+(d*2) << a+(d*3) << a+(d*4) << a+(d*5) << a+(d*6) << "\n";}

if (i==5)

{std::cout << a+(e*1) << a+(e*2) << a+(e*3) << a+(e*4) << a+(e*5) << a+(e*6) << "\n";}

if (i==6)

{std::cout << a+(f*1) << a+(f*2) << a+(f*3) << a+(f*4) << a+(f*5) << a+(f*6) << "\n";}

system("PAUSE");

return 0;

}