Re: cash register program
Don't you think "It does not work" is a little too general for someone you expect to fix something?
If you rip your car's engine from your car, get it to the repair center and tell them that something on your car "does not work", do you expect them to tell you why?
Re: cash register program
Yes I do expect them to tell me what is wrong with my car. They are experts and they know what it is supposed to look like and they know what errors or imperfections look like. Also, your analogy is not relevant. I have ripped the 'engine' from my program and told you that the 'engine' doesn't work, not the whole program. Don't you think it would be impossible to diagnose an engine problem if you are not a mechanic or someone with knowledge in that field? Same applies here. I am in no way an expert and I don't have a clue why it doesn't work or what is wrong with it. Next time you make a snark comment, think it through. Better yet, instead of wasting your time and my time, HELP SOMEONE.
Re: cash register program
Swap the %s and /s and use ints for those bills (you can cast the values to double afterwards; the requirements don't make any sense).
kind regards,
Jos
Re: cash register program
I wouldn't use doubles. I would use ints for this type of thing. I can't see the declaration of "take" but it should probably be an int too.
Re: cash register program
Quote:
Originally Posted by
lanmonster
Yes I do expect them to tell me what is wrong with my car. They are experts and they know what it is supposed to look like and they know what errors or imperfections look like.
Don't you think it would be better to take the car to them and not just the engine that does not run like that even if it is ok? A mecahnic that cannot run the engine won't be able to tell you what is wrong and will shake his head for you disassembling the engine from the car...
Quote:
Next time you make a snark comment, think it through. Better yet, instead of wasting your time and my time, HELP SOMEONE.
This is completly thought through, but obviously you do not understand it so I will make it clearer: Tell WHAT does not work. If you don't post a working piece of code you need to at LEAST tell what the symptoms are because no one can reproduce or wants to wase time to try to reproduce your error you do not describe.
If you look at the comments you see "I can't see the declaration of "take" but it should probably be an int too" - the experts can do nothing more than wast guessing at what your problem might be at all!
A proper description contains what you did, what you would expect and what really happens that makes you think that there is a problem. Easy example for you:
- The input is 5
- My expected output is 7 but the real output is 8
This would be completly sufficient for a first answer. Snarling like you did moves you barely into the right direction... from what I can see I think your problem is simply that
- you use the modulo operator and division incorrectly here (maybe as Josh said you confused the usage of them).
- as has been said already your variables need to be integer.
Re: cash register program
Quote:
Originally Posted by
lanmonster
Next time you make a snark comment, think it through. Better yet, instead of wasting your time and my time, HELP SOMEONE.
Any more rudeness like that and you will be banned for a period. There will be no further warning.
db
Re: cash register program
Quote:
Originally Posted by
kaydell2
I wouldn't use doubles. I would use ints for this type of thing. I can't see the declaration of "take" but it should probably be an int too.
when I try to use ints it does not compile and it tells me that there may be a loss of accuracy...
Re: cash register program
im not too sure why it should be ints, maybe because of the use of the modulous ? is this program supposed to tell you how many of each bill is inside a certain value? so i input 150, it tells me that (1)$100 and (1)$50 bill are what you need to give me back? just a thought but if take is any number thats evenly divisible by these numbers your result would be 0. for example 100 would be in your first statement and take(100) % 100 = 0. now 0/100 = 0 so your answer would be incorrect. your problem here looks like mostly arithmatic but as Sierra said we cannot hope to help you unless you tell us what the actual error is that your getting
Re: cash register program
Quote:
Originally Posted by
lanmonster
when I try to use ints it does not compile and it tells me that there may be a loss of accuracy...
Then you're trying to convert (say) a double to an int without telling the compiler that you know what you're doing; because you don't understand the error message, you don't know what you're doing ...
kind regards,
Jos