Code:
else if (length1 > 6 || length2 > 6)
{
calc(); // if false returns to calculator funtion
}
This doesn't return back to calc(), this calls it. So all your program is doing running the first three lines of calc() over and over again. You might want to define validation1 as returning an int and then replacethis code with:
Code:
else if (length1 > 6 || length2 > 6)
{
return 0; // if false returns to calculator funtion
}
Also
Code:
if (length2 <= 6 && convertnum2 > 0 && convertnum2 < 999)
{
}
What's thepurpose of this? You are evaluating a condition but then not doing anything if it is true.
Your code is a little confusing. I assume that num1 etc are characters as you have used string functions on them, but that leads me to ask why you named them num1 etc.