Given a and b, n is the sum of the squares of a and b. e.g. (a,b)=(1,2)-->n=5
Break 2n into a sum of two squares and output!
e.g.2n=10-->(a,b)=(1,3)
(yes it is always possible :)
Think before you code!Good luck!
using namespace std;
pair<int, int> two_squares(int a,int b){
return make_pair(b-a,a+b);
}
// TODO: Replace examples and use TDD by writing your own tests
using namespace std;
Describe(Small_examples)
{
It(Example_tests)
{
Assert::That(two_squares(1,2), Equals(make_pair(1,3)));
Assert::That(two_squares(2,6), Equals(make_pair(4,8)));
Assert::That(two_squares(2,5), Equals(make_pair(3,7)));
}
};