Hey everyone,
While in class I made a program that calculates Pythagorean Triples from 1 to 100 in C++. I recently "converted" it into Alice, but it runs
extremely slow, so it runs from 1 to 10 (or else takes forever to come up with the first triple).
It's kinda useless, but who knows, maybe someone will find a use for it.
C++ code:
Code:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x;
double y;
double z;
for (double a = 1; a <= 100; a++)
{
for (double b = 1; b <= 100; b++)
{
for (double c = 1; c <= 100; c++)
{
x = pow(a, 2);
y = pow(b, 2);
z = pow(c, 2);
if (x + y == z)
{
cout << "(" << a << "," << b << "," << c << ")" << endl;
}
}
}
}
return 0;
}