[snip]
Why defining parameters you don't use at all ?
[snip]
Why using 'float' instead of 'double' ?
[snip]
(FAQ) The string is not terminated by a '\n'. Depending on the
platform, it may output on stdout or not. To be sure of it, force it:
fflush (stdout);
[snip]
What happens if the user types a wrong entry ? scanf() is a difficult
function, not only for beginners. I suggest a combination of fgets()
and strtod().
[snip]
What if the rate changes ?
[snip]
Bare in mind that this 'trick' is due to your C implementation.
Greetings Emmanuel,
I think you may have missed an earlier post of mine in this thread, or maybe
just misunderstood it, so I'll post it again. I am brand new to any type of
programming, and I've only read nine chapters (small ones too) of an
incredibly basic approach to the C language. The only reason I even posted
that code was to show the OP how to put into practical use what was being
taught. He mentioned that he was only able to work and alter pre-made code,
and asked me what I was doing. With that said, I will try to answer your
questions.
#1. This was done by the DevC++ editor after I chose the option to create a
new project (console). Yes, I could have and should have, just used int
main().
#2. Why use 'double'? I wrote this program for myself to determine the cost
of an eBay auction that was in British pounds (this was before eBay provided
that info). I knew I would not be entering anything requiring 'double'.
#3. Sorry, I didn't get that far yet, so I made use of what I knew. I'll be
on the lookout for that though.
#4. I agree 100% with you on this. However, as above, I haven't yet learned
any other way of doing it yet.
#5. I was, and am aware of that, and it frustrates the hell out of me. As a
matter of fact, it does change quite often. What do you suggest?
#6. Yes, I understand that it is not very portable. But again, it was only
for my use (I know, that's no excuse), and it was really fun to go through
the thought process for designing it.
Best,
newby2c