recursive cstido help

im very new!
having problem understand recursive in cstdio
i google it but most search give a different library
i have a lab next week and want to prepare for it.
the program should give valid input from user 1-10 and if over or under give error message.
but if they entered a valid number between 1-10 should say thank you
the only problem i am having is that if they entered a number between 1-10 it just goes in loop over and over again.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
float Range(float min,float max);
int main()
{
printf("blabla");
float value = range(1,10);
printf("thank you %g", value);
return 0;
}
float Range(float min, float max)
{
bool data = false;
float val= 0;
int read;
printf(" enter number %g to %g" , min,max)
read = scanf("g", &val);
if(read ==0){
prinf(" ");
scanf("%*s");
}
else if (val<1){
printf(" ");
}
else if (val>10){
printf(" ");
}
else {
}
if (data==false){
   val = range(min,max);
}
return val;
  


im not sure but i think im missing a return some where
Last edited on
never mind figured it out missing a return val under else{
Please note: don't forget to mark this topic complete.

Thanks,

~Hirokachi
Topic archived. No new replies allowed.