Is this coding write Please check for me

dagreat45 (12)
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;
}
nano511 (362)
Put your code in code blocks with proper indentations. Tell us what problem you are having. Post errors if you have any.
Registered users can post here. Sign in or register to post.