View Single Post
Old 02-15-2008, 09:49 PM   #6 (permalink)
SpikedCola
 
Super Techie

Join Date: Jan 2006

Location: Ontario, Canada

Posts: 456

SpikedCola is on a distinguished road

Send a message via MSN to SpikedCola
Default Re: C# Ideas - Working With Coins & Bills

Hmm yeah kinda what I thought. When it converts to an int, it rounds, so lets say I put in $359.99, it spits out 4 hundreds. This is what Im using (since I was right about it crying):

Code:
            double money; //, hundreds; //, fifties, twenties, tens, fives, toonies, 
                                    // loonies, quarters, dimes, nickels, pennies;
            string name1 = "Jordan"; // , name2 = "", name3 = "";
                         
            Console.WriteLine("How much did " + name1 + " make?");
            Console.Write("$");
            money = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Converting {0:C} into change ...", money);

            int hundreds;
            
            hundreds = Convert.ToInt32(money / 100);  // determine the number of hundreds
            money -= hundreds * 100;  // subtract all the hundreds
                                                            
            Console.WriteLine("Hundreds: "+ hundreds +"");

__________________

Asus P5E | Q6600 | 2x2GB Corsair Dominator DDR2-1066 | BFG 8800GTS | 5x1.5TB SATA2 | 2x500GB SATA2 in RAID1
SpikedCola is offline