### Help On Written Function

I need help big Time I am having trouble trying to do this assignment
Write a C++ function void triplets(void) which computes and outputs the pythagorean triplets for the diophantine equation:

a^2+b^2=c^2, in the range 1<a,b,c<30.
1 day ago - 3 days left to answer.
here is my code below check whats wrong with it please

#include <iostream>
#include <cmath>
using namespace std;

template <class T>
bool is_valid(const T& tMin, const T& tMax, const T& number)
{
return number <= tMax && number >= tMin ? true : false;
}

template <class T>
T get_number(const string& strPrompt, const T& tMin, const T& tMax)
{
bool bContinue = false;
cout << strPrompt;
T tRet;
do {
cin >> tRet;
bContinue = !is_valid(tMin, tMax, tRet);
if (bContinue) {
cout << "Range: " << tMin << " <= x <= " << tMax << endl;
}
} while(bContinue);
return tRet;
}

double get_base(double& a, double& b)
{
a = get_number("a: ", 1.0, 30.0);
b = get_number("b: ", 1.0, 30.0);
return sqrt(a * a + b * b);
}

int main()
{
double a = 0.0, b = 0.0;

cout << "sqrt(a^2 + b^2) = " << get_base(a, b);
return 0;
}
Diophantine equation allows the variables to be integers only.
Topic archived. No new replies allowed.