Your use of global vars "roottofind" and "input" seem misguided. They don't really aid you in information-sharing between multiple functions, and only make the rest of your funcs easier to mistype, so I would get rid them altogether and just have be local variables within main() or inputnumber().
Are you required to use this custom sqrroot function? B/c if you #include <cmath> there's a very good "sqrt()" function for just that purpose?
Your use of stringstream in this program doesn't really gain you anything either. If you want to validate the user's input and make sure it works as a double, that's not a bad thing tho. You should do something like read in the input as string first, then run std::strtod() (good documentation on that can be found on this site or cppreference.com) on it. Or read it in as double and then check if cin failed using "if (!cin)".
The reason you were stuck in this loop-of-asking you described is that your local variable input was never assigned the new value within the while-loop on line 46. it should be:
1 2
|
while(input <= 0)
input = inputnumber();
|
Also I'd avoid recursion wherever possible as its slower than iteration and eats up stack space. In some cases recursion is very helpful, but in yours it doesn't look like it is, especially because you have a large and expensive stream object eating up much, much stack space! A simple while loop in inputnumber() that demands re-entering the number if its <= 0, will do.