I'm writing a C (not C++) program where I want to convert money from one currency to another and I need to round US dollars to the nearest cent. I was thinking about storing the number into an array of type char, but I do not know how to do this.
The user will enter a double type number, then a calculation will be performed on this number to convert it to the other country's currency, then this converted number needs to be rounded to 2 decimal places. So how the hell do I round a number after doing a calculation on the number that the user inputs? How can I store this unknown converted number into a char array of unknown size? How can I round this number to 2 decimal places, which then I will print out? Please help me, as I am a beginner in C programming and do not know much about C. Once again, this program is in C and not C++.
2007-02-05
07:27:17
·
2 answers
·
asked by
anonms420
1
in
Computers & Internet
➔ Programming & Design