Review logic error

Do I have a logic error in 35-47 (48-60)? Or is it in int main?

 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 14 using namespace std; 15 16 float get_float(string message); 17 float check_valid_input(float check, float low, float high); 18 float calc_rect_area(float width, float height); 19 20 int main () 21 { 22 float check, low, high; 23 float width, height; 24 string message; 25 26 const float MIN_VALUE = 1; 27 const float MAX_VALUE = 10; 28 29 float my_input = get_float("Enter a number from 1 to 10 "); 30 float sample_width = get_float("Enter the width for some imaginary rectangle"); 31 float sample_height = get_float("Enter the height for some imaginary rectangle"); 32 33 cout << my_input << endl; 34 35 cout << check_valid_input(my_input, MIN_VALUE, MAX_VALUE) << endl; 36 37 cout << calc_rect_area(sample_width, sample_height) << endl; 38 39 return 0; 40 } 41 42 float get_float(string message) 43 { 44 float check = atof(message.c_str()); 45 return check; 46 } 47 48 float check_valid_input(float check, float low, float high) 49 { 50 float neg = -1.0; 51 52 if(check >= low && check <= high) 53 { 54 return check; 55 } 56 else 57 { 58 return neg; 59 } 60 } 61 62 float calc_rect_area(float width, float height) 63 { 64 if (height == 0) 65 return 0; 66 else 67 return width + calc_rect_area(width, --height); 68 }
See previous response:
http://www.cplusplus.com/forum/beginner/113992/#msg622885

It would help if you could just post the code, without the extra line numbers.
Topic archived. No new replies allowed.