I need to get input a double, and if the user will press "ENTER" it will continue.. when I use scanf(%lf,&num); the program waits that there will be some input, and if I press "ENTER" it doesn't continue.. (I'm not using files..)
I need to get input a double, and if the user will press "ENTER" it will continue.. when I use scanf(%lf,&num); the program waits that there will be some input, and if I press "ENTER" it doesn't continue.. (I'm not using files..)
So, what you want is that if the user DOES NOT enter any numeric value, some "previous" or "default" value is used, is that about right?
You could use fgets() to read a string in, then if the string isn't empty [note that fgets includes the newline in the string - so an empty string is "\n"], convert it to a double [using e.g. strtod() or sscanf()].
If that's not what you want, please clarify what you DO want.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
hmm i think you forgot the quotation marks around %lf, so it should be:
scanf ("%lf" , &num)