|
-
Apr 22nd, 2011, 01:08 PM
#1
Thread Starter
Member
help please
Code:
printf("Twenties: %d \n" , change_in_cents / CENTS_IN_TWENTY_DOLLARS);
change_in_cents % CENTS_IN_TWENTY_DOLLARS;
Im using both division and mod or thats whati think. can someone tell me if im doing something wrong here?
-
Apr 22nd, 2011, 02:23 PM
#2
Re: help please
That will be treated as two lines.
In this line:
Code:
printf("Twenties: %d \n" , change_in_cents / CENTS_IN_TWENTY_DOLLARS);
the division is performed and the integer result is printed.
And in the second line, you are just performing the modulus operation but not assigning the result anywhere.
If you are trying to print both, then something like this can be done:
Code:
printf("Twenties: %d.%d \n" , change_in_cents / CENTS_IN_TWENTY_DOLLARS, change_in_cents % CENTS_IN_TWENTY_DOLLARS);
I didn't tested the code.
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Apr 22nd, 2011, 08:13 PM
#3
Re: help please
@ mattkeem,
For future reference could you please put a reference to what the question your ask is in the thread title rather than "help please" it will allow users to determine if they would be able to help or not. Also, it would help other people looking for an answer to the same problem.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Apr 22nd, 2011, 10:10 PM
#4
Thread Starter
Member
Re: help please
Sorry about that ill reference it better next time. However im not trying to get two outputs but only one. What im trying to do is just say if i purchased simething for 30 dollars and u gave them a 100 dollar bill. You should get 3 twenties and one ten. Tats what im trying to display. I got everything right but the displaying how many twenties and ten i cant seem to do it
-
Apr 23rd, 2011, 12:18 AM
#5
Re: help please
Then try something like this:
Code:
printf("Twenties: %d\n Tens: %d \n" , change_in_cents / CENTS_IN_TWENTY_DOLLARS, change_in_cents % CENTS_IN_TWENTY_DOLLARS);
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|