J
Jason Heyes
A pythagorean triple is a triple <a,b,c> whose components are positive
integers satisfying a*a + b*b = c*c. An example is <3,4,5> since 3*3 + 4*4 =
9 + 16 = 25 = 5*5.
I want to write a function to extract pythagorean triples from an input
stream. The input is formatted so that only the first two components <a,b>
of a pythagorean triple are specified. The function signature will be:
std::istream &operator>>(std::istream &is, PythagoreanTriple &triple);
Can anyone write me some good working code that implements this
functionality? This is not for a school project in case you're wondering.
Thanks.
integers satisfying a*a + b*b = c*c. An example is <3,4,5> since 3*3 + 4*4 =
9 + 16 = 25 = 5*5.
I want to write a function to extract pythagorean triples from an input
stream. The input is formatted so that only the first two components <a,b>
of a pythagorean triple are specified. The function signature will be:
std::istream &operator>>(std::istream &is, PythagoreanTriple &triple);
Can anyone write me some good working code that implements this
functionality? This is not for a school project in case you're wondering.
Thanks.