Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Turing Help!!!!!!!!
Author Message
spiderman

Posted: Mon Dec 12, 2005 5:09 pm   Post subject: Turing Help!!!!!!!!

In turing, how do you input a dollar ammount representing the fewest number of bills and codes? An example would be \$25.53 dollars which is a twentie dollar bill, a five dollar bill, two quarters and three pennies. How would u do that on turing so that the user enters whatever dollar amount they want and answers it in fewest number of bills and coins. I know u have to use mod and div operators but my code just doesnt seem to work
Does anyone know the code for this?

Mazer

Posted: Mon Dec 12, 2005 5:45 pm   Post subject: (No subject)

Second, you should have posted this in [Turing Help] (moved)

Third, it's best not to use descriptions like "Turing Help!!!!!!!!" as that is more likely to make us hate you than it is to make us want to help you.
foo fighter

Posted: Mon Dec 12, 2005 5:52 pm   Post subject: (No subject)

[mod:dffcccb924="Cervantes"]
Personal conversations may be carried out via Private Messages, please and thank you. Click the "PM" button under a user's name to PM him. Or her.[/mod:dffcccb924]
Albrecd

Posted: Mon Dec 12, 2005 6:15 pm   Post subject: (No subject)

Asok Said:
Quote:
any thread with the topic title is general such as "I need help" "help me please" "Help fast ASAP" will be deleted and you will not recieve help.

Anyway... You could devide the total by the highest value that can be held by a bill (round down), then multiply the quocient by the value of that bill, then subtract the product from the inputted value, then do the same with the other bill and coin values in decending order.

Ex:
 code: var input, NumBill50, NumBill50Round : real var NumBills : int Const DOLLARS50 := 50 NumBill50 := input / DOLLARS50     %Devide the input by 50 for \$50 bill NumBill50Round := input div DOLLARS50 %Same as ^ with rounding if NumBill50 < NumBill50Round then           %If the unrounded quocient is NumBill50Round -= 1                                %Lower than the rounded end if                                                       %quocient, It has rounded up, %Keep Track of the number of \$50 bills...   %but it must round down so                                                                %we subtract one. input -= NumBill50Round %Then do the same thing with the next bill or coin value and so on %Yes, I am aware that \$50 is not the highest Canadian bill value.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 4 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: